method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static Object parse(byte[] xml, String encoding){ try{ XMLMediaParser parser = new XMLMediaParser(new ByteArrayInputStream(xml, 0, xml.length - 1), encoding); return parser.parse(); } catch(XMLStreamException e){ e.printStackTrace(); return null; } catch(XMLParserException e){ e.printStackTrace(); return null; } }
static Object function(byte[] xml, String encoding){ try{ XMLMediaParser parser = new XMLMediaParser(new ByteArrayInputStream(xml, 0, xml.length - 1), encoding); return parser.parse(); } catch(XMLStreamException e){ e.printStackTrace(); return null; } catch(XMLParserException e){ e.printStackTrace(); return null; } }
/** * Parse {@code xml} into an object using the specified {@code encoding}. * * @param xml The xml as bytes. * @param encoding The encoding to use. * * @return An object if successful, null if not. */
Parse xml into an object using the specified encoding
parse
{ "repo_name": "TTGhost/jotify", "path": "src/de/felixbruns/jotify/media/parser/XMLMediaParser.java", "license": "bsd-2-clause", "size": 27766 }
[ "java.io.ByteArrayInputStream", "javax.xml.stream.XMLStreamException" ]
import java.io.ByteArrayInputStream; import javax.xml.stream.XMLStreamException;
import java.io.*; import javax.xml.stream.*;
[ "java.io", "javax.xml" ]
java.io; javax.xml;
187,367
public JsonStaxPrinter array(final long[] array) throws IOException { if (closed) { throw new IOException("Attempt to write into closed printer"); } else if (pseudoStackState[pseudoStackFill] != VALUE_AWAITING) { throw new IOException("Output structure failure: value is not awaiting here"); } else { if (array == null) { return nullValue(); } else { startArray(); for (int index = 0, maxIndex = array.length; index < maxIndex; index++) { if (index > 0) { splitter(); } value(array[index]); } endArray(); pseudoStackState[pseudoStackFill] = SPLITTER_AWAITING; return this; } } }
JsonStaxPrinter function(final long[] array) throws IOException { if (closed) { throw new IOException(STR); } else if (pseudoStackState[pseudoStackFill] != VALUE_AWAITING) { throw new IOException(STR); } else { if (array == null) { return nullValue(); } else { startArray(); for (int index = 0, maxIndex = array.length; index < maxIndex; index++) { if (index > 0) { splitter(); } value(array[index]); } endArray(); pseudoStackState[pseudoStackFill] = SPLITTER_AWAITING; return this; } } }
/** * <p>Print array of long</p> * @param array array to print * @return self * @throws IOException on any I/O errors */
Print array of long
array
{ "repo_name": "chav1961/purelib", "path": "src/main/java/chav1961/purelib/streams/JsonStaxPrinter.java", "license": "mit", "size": 26295 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,324,993
public Resource findResourceByName(String resourceName) { Resource resource = null; int count = Dispatch.get(resources, "Count").getInt(); for (int i = 0; i < count; i++) { Dispatch curResource = Dispatch .invoke(resources, "Item", Dispatch.Get, new Object[] { i + 1 }, new int[] { 1 }).toDispatch(); String curResourceName = Dispatch.get(curResource, "Name").getString(); if (resourceName.equals(curResourceName)) { resource = new Resource(curResource, msProjApp); break; } } return resource; }
Resource function(String resourceName) { Resource resource = null; int count = Dispatch.get(resources, "Count").getInt(); for (int i = 0; i < count; i++) { Dispatch curResource = Dispatch .invoke(resources, "Item", Dispatch.Get, new Object[] { i + 1 }, new int[] { 1 }).toDispatch(); String curResourceName = Dispatch.get(curResource, "Name").getString(); if (resourceName.equals(curResourceName)) { resource = new Resource(curResource, msProjApp); break; } } return resource; }
/** * Iterate all resource and find the resource matches * * @param resourceName * @return */
Iterate all resource and find the resource matches
findResourceByName
{ "repo_name": "evildracula/JavaOnMsProject", "path": "src/main/java/ext/project/ms/msproject/MPPFileOperation.java", "license": "mit", "size": 7708 }
[ "com.jacob.com.Dispatch" ]
import com.jacob.com.Dispatch;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
2,018,940
public static Map.Entry<String, Map<String, ?>> hideKeyboardCommand(String strategy, String keyName) { String[] parameters = new String[]{"strategy", "key"}; Object[] values = new Object[]{strategy, keyName}; return new AbstractMap.SimpleEntry<>( HIDE_KEYBOARD, prepareArguments(parameters, values)); }
static Map.Entry<String, Map<String, ?>> function(String strategy, String keyName) { String[] parameters = new String[]{STR, "key"}; Object[] values = new Object[]{strategy, keyName}; return new AbstractMap.SimpleEntry<>( HIDE_KEYBOARD, prepareArguments(parameters, values)); }
/** * This method forms a {@link java.util.Map} of parameters for the * keyboard hiding. * * @param strategy HideKeyboardStrategy. * @param keyName a String, representing the text displayed on the button of the * keyboard you want to press. For example: "Done". * @return a key-value pair. The key is the command name. The value is a * {@link java.util.Map} command arguments. */
This method forms a <code>java.util.Map</code> of parameters for the keyboard hiding
hideKeyboardCommand
{ "repo_name": "appium/java-client", "path": "src/main/java/io/appium/java_client/MobileCommand.java", "license": "apache-2.0", "size": 25961 }
[ "java.util.AbstractMap", "java.util.Map" ]
import java.util.AbstractMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
755,711
public Map<Host, Set<String>> retrieveWlbRecommendations(Connection c) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = "VM.retrieve_wlb_recommendations"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toMapOfHostSetOfString(result); }
Map<Host, Set<String>> function(Connection c) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toMapOfHostSetOfString(result); }
/** * Returns mapping of hosts to ratings, indicating the suitability of starting the VM at that location according to wlb. Rating is replaced with an error if the VM cannot boot there. * * @return The potential hosts and their corresponding recommendations or errors */
Returns mapping of hosts to ratings, indicating the suitability of starting the VM at that location according to wlb. Rating is replaced with an error if the VM cannot boot there
retrieveWlbRecommendations
{ "repo_name": "cinderella/incubator-cloudstack", "path": "deps/XenServerJava/com/xensource/xenapi/VM.java", "license": "apache-2.0", "size": 169722 }
[ "com.xensource.xenapi.Types", "java.util.Map", "java.util.Set", "org.apache.xmlrpc.XmlRpcException" ]
import com.xensource.xenapi.Types; import java.util.Map; import java.util.Set; import org.apache.xmlrpc.XmlRpcException;
import com.xensource.xenapi.*; import java.util.*; import org.apache.xmlrpc.*;
[ "com.xensource.xenapi", "java.util", "org.apache.xmlrpc" ]
com.xensource.xenapi; java.util; org.apache.xmlrpc;
1,830,872
List<T> find(String query);
List<T> find(String query);
/** * executes hibernate query <br> * (e.g. select address from person p join p.address) * * @param query * simple HQL query string * @return list of returned objects */
executes hibernate query (e.g. select address from person p join p.address)
find
{ "repo_name": "R3d-Dragon/jMovieManager", "path": "jMMCore/src/jmm/persist/DaoInterface.java", "license": "lgpl-2.1", "size": 3551 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
747,017
public void setAutolayoutActivisionThreshold(final int value) { Preconditions.checkArgument(value >= 0, "IE00901: Threshold value must not be negative"); if (value == getAutolayoutDeactivationThreshold()) { return; } if (m_type == null) { m_autoLayoutDeactivationThreshold = value; } else { m_type.setAnimationSpeed(value); } }
void function(final int value) { Preconditions.checkArgument(value >= 0, STR); if (value == getAutolayoutDeactivationThreshold()) { return; } if (m_type == null) { m_autoLayoutDeactivationThreshold = value; } else { m_type.setAnimationSpeed(value); } }
/** * Changes the current autolayout deactivation setting. * * @param value The new value of the autolayout deactivation setting. */
Changes the current autolayout deactivation setting
setAutolayoutActivisionThreshold
{ "repo_name": "ispras/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/yfileswrap/zygraph/Settings/ZyGraphLayoutSettings.java", "license": "apache-2.0", "size": 12974 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
894,281
private void checkDS(DataSources ds) { List<DataSource> listDs = ds.getDataSource(); assertEquals(1, listDs.size()); DataSource d = listDs.get(0); assertFalse(d.isJTA()); assertTrue(d.isSpy()); assertFalse(d.isEnabled()); assertFalse(d.isUseCcm()); assertTrue(d.isConnectable()); assertFalse(d.isTracking()); assertEquals("java:jboss/datasources/complexDs", d.getJndiName()); assertEquals("complexDs_Pool", d.getPoolName()); assertEquals("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", d.getConnectionUrl()); assertEquals("org.hsqldb.jdbcDriver", d.getDriverClass()); assertEquals("org.pg.JdbcDataSource", d.getDataSourceClass()); assertEquals("h2", d.getDriver()); Map<String, String> properties = d.getConnectionProperties(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("select 1", d.getNewConnectionSql()); assertEquals(":", d.getUrlDelimiter()); assertEquals("someClass", d.getUrlSelectorStrategyClassName()); assertEquals(TransactionIsolation.valueOf("2"), d.getTransactionIsolation()); DsPool pool = d.getPool(); assertNotNull(pool); assertEquals(1, (int)pool.getMinPoolSize()); assertEquals(2, (int)pool.getInitialPoolSize()); assertEquals(5, (int)pool.getMaxPoolSize()); assertTrue(pool.isPrefill()); assertTrue(pool.isUseStrictMin()); assertEquals(FlushStrategy.ALL_CONNECTIONS, pool.getFlushStrategy()); assertTrue(pool.isAllowMultipleUsers()); Capacity cp = pool.getCapacity(); assertNotNull(cp); Extension e = cp.getIncrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("ic", e.getClassName()); e = cp.getDecrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("dc", e.getClassName()); DsSecurity s = d.getSecurity(); assertNotNull(s); assertEquals("sa", s.getUserName()); assertEquals("sa", s.getPassword()); e = s.getReauthPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass1", e.getClassName()); Validation v = d.getValidation(); assertNotNull(v); assertEquals("select 1", v.getCheckValidConnectionSql()); assertTrue(v.isBackgroundValidation()); assertTrue(v.isValidateOnMatch()); assertTrue(v.isUseFastFail()); assertEquals(2000L, (long)v.getBackgroundValidationMillis()); e = v.getValidConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass2", e.getClassName()); e = v.getStaleConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass3", e.getClassName()); e = v.getExceptionSorter(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass4", e.getClassName()); Timeout t = d.getTimeout(); assertNotNull(t); assertEquals(20000L, (long)t.getBlockingTimeoutMillis()); assertEquals(4L, (long)t.getIdleTimeoutMinutes()); assertEquals(120L, (long)t.getQueryTimeout()); assertEquals(100L, (long)t.getUseTryLock()); assertEquals(2L, (long)t.getAllocationRetry()); assertEquals(3000L, (long)t.getAllocationRetryWaitMillis()); assertTrue(t.isSetTxQueryTimeout()); Statement st = d.getStatement(); assertNotNull(st); assertEquals(30L, (long)st.getPreparedStatementsCacheSize()); assertTrue(st.isSharePreparedStatements()); assertEquals(TrackStatementsEnum.NOWARN, st.getTrackStatements()); List<XaDataSource> xds = ds.getXaDataSource(); assertEquals(1, xds.size()); XaDataSource xd = xds.get(0); assertFalse(xd.isSpy()); assertTrue(xd.isEnabled()); assertTrue(xd.isUseCcm()); assertFalse(xd.isConnectable()); assertTrue(xd.isTracking()); assertEquals("java:jboss/xa-datasources/complexXaDs", xd.getJndiName()); assertEquals("complexXaDs_Pool", xd.getPoolName()); assertEquals("org.pg.JdbcXADataSource", xd.getXaDataSourceClass()); assertEquals("pg", xd.getDriver()); properties = xd.getXaDataSourceProperty(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("select 1", xd.getNewConnectionSql()); assertEquals(":", xd.getUrlDelimiter()); assertEquals("someClass", xd.getUrlSelectorStrategyClassName()); assertEquals(TransactionIsolation.TRANSACTION_READ_COMMITTED, xd.getTransactionIsolation()); DsXaPool xpool = xd.getXaPool(); assertNotNull(xpool); assertEquals(1, (int)xpool.getMinPoolSize()); assertEquals(2, (int)xpool.getInitialPoolSize()); assertEquals(5, (int)xpool.getMaxPoolSize()); assertTrue(xpool.isPrefill()); assertTrue(xpool.isUseStrictMin()); assertEquals(FlushStrategy.GRACEFULLY, xpool.getFlushStrategy()); assertTrue(xpool.isInterleaving()); assertTrue(xpool.isIsSameRmOverride()); assertTrue(xpool.isNoTxSeparatePool()); assertTrue(xpool.isPadXid()); assertFalse(xpool.isWrapXaResource()); assertTrue(xpool.isAllowMultipleUsers()); cp = xpool.getCapacity(); assertNotNull(cp); e = cp.getIncrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("ic", e.getClassName()); e = cp.getDecrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("dc", e.getClassName()); s = xd.getSecurity(); assertNotNull(s); assertEquals("HsqlDbRealm", s.getSecurityDomain()); e = s.getReauthPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass1", e.getClassName()); Recovery r = xd.getRecovery(); assertNotNull(r); assertFalse(r.isNoRecovery()); Credential c = r.getCredential(); assertNotNull(c); assertEquals("HsqlDbRealm", c.getSecurityDomain()); e = r.getRecoverPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass5", e.getClassName()); v = xd.getValidation(); assertNotNull(v); assertEquals("select 1", v.getCheckValidConnectionSql()); assertTrue(v.isBackgroundValidation()); assertTrue(v.isValidateOnMatch()); assertTrue(v.isUseFastFail()); assertEquals(2000L, (long)v.getBackgroundValidationMillis()); e = v.getValidConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass2", e.getClassName()); e = v.getStaleConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass3", e.getClassName()); e = v.getExceptionSorter(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals("Property1", properties.get("name1")); assertEquals("Property2", properties.get("name2")); assertEquals("someClass4", e.getClassName()); t = xd.getTimeout(); assertNotNull(t); assertEquals(20000L, (long)t.getBlockingTimeoutMillis()); assertEquals(4L, (long)t.getIdleTimeoutMinutes()); assertEquals(120L, (long)t.getQueryTimeout()); assertEquals(100L, (long)t.getUseTryLock()); assertEquals(2L, (long)t.getAllocationRetry()); assertEquals(3000L, (long)t.getAllocationRetryWaitMillis()); assertTrue(t.isSetTxQueryTimeout()); st = xd.getStatement(); assertNotNull(st); assertEquals(30L, (long)st.getPreparedStatementsCacheSize()); assertTrue(st.isSharePreparedStatements()); assertEquals(TrackStatementsEnum.TRUE, st.getTrackStatements()); List<Driver> drivers = ds.getDrivers(); assertEquals(2, drivers.size()); Driver driver = ds.getDriver("h2"); assertTrue(drivers.contains(driver)); assertNotNull(driver); assertEquals("h2", driver.getName()); assertEquals(null, driver.getMajorVersion()); assertEquals(null, driver.getMinorVersion()); assertEquals("com.h2database.h2", driver.getModule()); assertEquals(null, driver.getDriverClass()); assertEquals(null, driver.getXaDataSourceClass()); assertEquals("org.h2.jdbcx.JdbcDataSource", driver.getDataSourceClass()); driver = ds.getDriver("pg"); assertNotNull(driver); assertTrue(drivers.contains(driver)); assertEquals(9, (int)driver.getMajorVersion()); assertEquals(1, (int)driver.getMinorVersion()); assertEquals("org.pg.postgres", driver.getModule()); assertEquals("org.pg.Driver", driver.getDriverClass()); assertEquals("org.pg.JdbcDataSource", driver.getXaDataSourceClass()); assertEquals(null, driver.getDataSourceClass()); }
void function(DataSources ds) { List<DataSource> listDs = ds.getDataSource(); assertEquals(1, listDs.size()); DataSource d = listDs.get(0); assertFalse(d.isJTA()); assertTrue(d.isSpy()); assertFalse(d.isEnabled()); assertFalse(d.isUseCcm()); assertTrue(d.isConnectable()); assertFalse(d.isTracking()); assertEquals(STR, d.getJndiName()); assertEquals(STR, d.getPoolName()); assertEquals(STR, d.getConnectionUrl()); assertEquals(STR, d.getDriverClass()); assertEquals(STR, d.getDataSourceClass()); assertEquals("h2", d.getDriver()); Map<String, String> properties = d.getConnectionProperties(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, d.getNewConnectionSql()); assertEquals(":", d.getUrlDelimiter()); assertEquals(STR, d.getUrlSelectorStrategyClassName()); assertEquals(TransactionIsolation.valueOf("2"), d.getTransactionIsolation()); DsPool pool = d.getPool(); assertNotNull(pool); assertEquals(1, (int)pool.getMinPoolSize()); assertEquals(2, (int)pool.getInitialPoolSize()); assertEquals(5, (int)pool.getMaxPoolSize()); assertTrue(pool.isPrefill()); assertTrue(pool.isUseStrictMin()); assertEquals(FlushStrategy.ALL_CONNECTIONS, pool.getFlushStrategy()); assertTrue(pool.isAllowMultipleUsers()); Capacity cp = pool.getCapacity(); assertNotNull(cp); Extension e = cp.getIncrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals("ic", e.getClassName()); e = cp.getDecrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals("dc", e.getClassName()); DsSecurity s = d.getSecurity(); assertNotNull(s); assertEquals("sa", s.getUserName()); assertEquals("sa", s.getPassword()); e = s.getReauthPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); Validation v = d.getValidation(); assertNotNull(v); assertEquals(STR, v.getCheckValidConnectionSql()); assertTrue(v.isBackgroundValidation()); assertTrue(v.isValidateOnMatch()); assertTrue(v.isUseFastFail()); assertEquals(2000L, (long)v.getBackgroundValidationMillis()); e = v.getValidConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); e = v.getStaleConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); e = v.getExceptionSorter(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); Timeout t = d.getTimeout(); assertNotNull(t); assertEquals(20000L, (long)t.getBlockingTimeoutMillis()); assertEquals(4L, (long)t.getIdleTimeoutMinutes()); assertEquals(120L, (long)t.getQueryTimeout()); assertEquals(100L, (long)t.getUseTryLock()); assertEquals(2L, (long)t.getAllocationRetry()); assertEquals(3000L, (long)t.getAllocationRetryWaitMillis()); assertTrue(t.isSetTxQueryTimeout()); Statement st = d.getStatement(); assertNotNull(st); assertEquals(30L, (long)st.getPreparedStatementsCacheSize()); assertTrue(st.isSharePreparedStatements()); assertEquals(TrackStatementsEnum.NOWARN, st.getTrackStatements()); List<XaDataSource> xds = ds.getXaDataSource(); assertEquals(1, xds.size()); XaDataSource xd = xds.get(0); assertFalse(xd.isSpy()); assertTrue(xd.isEnabled()); assertTrue(xd.isUseCcm()); assertFalse(xd.isConnectable()); assertTrue(xd.isTracking()); assertEquals(STR, xd.getJndiName()); assertEquals(STR, xd.getPoolName()); assertEquals(STR, xd.getXaDataSourceClass()); assertEquals("pg", xd.getDriver()); properties = xd.getXaDataSourceProperty(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, xd.getNewConnectionSql()); assertEquals(":", xd.getUrlDelimiter()); assertEquals(STR, xd.getUrlSelectorStrategyClassName()); assertEquals(TransactionIsolation.TRANSACTION_READ_COMMITTED, xd.getTransactionIsolation()); DsXaPool xpool = xd.getXaPool(); assertNotNull(xpool); assertEquals(1, (int)xpool.getMinPoolSize()); assertEquals(2, (int)xpool.getInitialPoolSize()); assertEquals(5, (int)xpool.getMaxPoolSize()); assertTrue(xpool.isPrefill()); assertTrue(xpool.isUseStrictMin()); assertEquals(FlushStrategy.GRACEFULLY, xpool.getFlushStrategy()); assertTrue(xpool.isInterleaving()); assertTrue(xpool.isIsSameRmOverride()); assertTrue(xpool.isNoTxSeparatePool()); assertTrue(xpool.isPadXid()); assertFalse(xpool.isWrapXaResource()); assertTrue(xpool.isAllowMultipleUsers()); cp = xpool.getCapacity(); assertNotNull(cp); e = cp.getIncrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals("ic", e.getClassName()); e = cp.getDecrementer(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals("dc", e.getClassName()); s = xd.getSecurity(); assertNotNull(s); assertEquals(STR, s.getSecurityDomain()); e = s.getReauthPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); Recovery r = xd.getRecovery(); assertNotNull(r); assertFalse(r.isNoRecovery()); Credential c = r.getCredential(); assertNotNull(c); assertEquals(STR, c.getSecurityDomain()); e = r.getRecoverPlugin(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); v = xd.getValidation(); assertNotNull(v); assertEquals(STR, v.getCheckValidConnectionSql()); assertTrue(v.isBackgroundValidation()); assertTrue(v.isValidateOnMatch()); assertTrue(v.isUseFastFail()); assertEquals(2000L, (long)v.getBackgroundValidationMillis()); e = v.getValidConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); e = v.getStaleConnectionChecker(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); e = v.getExceptionSorter(); properties = e.getConfigPropertiesMap(); assertEquals(2, properties.size()); assertEquals(STR, properties.get("name1")); assertEquals(STR, properties.get("name2")); assertEquals(STR, e.getClassName()); t = xd.getTimeout(); assertNotNull(t); assertEquals(20000L, (long)t.getBlockingTimeoutMillis()); assertEquals(4L, (long)t.getIdleTimeoutMinutes()); assertEquals(120L, (long)t.getQueryTimeout()); assertEquals(100L, (long)t.getUseTryLock()); assertEquals(2L, (long)t.getAllocationRetry()); assertEquals(3000L, (long)t.getAllocationRetryWaitMillis()); assertTrue(t.isSetTxQueryTimeout()); st = xd.getStatement(); assertNotNull(st); assertEquals(30L, (long)st.getPreparedStatementsCacheSize()); assertTrue(st.isSharePreparedStatements()); assertEquals(TrackStatementsEnum.TRUE, st.getTrackStatements()); List<Driver> drivers = ds.getDrivers(); assertEquals(2, drivers.size()); Driver driver = ds.getDriver("h2"); assertTrue(drivers.contains(driver)); assertNotNull(driver); assertEquals("h2", driver.getName()); assertEquals(null, driver.getMajorVersion()); assertEquals(null, driver.getMinorVersion()); assertEquals(STR, driver.getModule()); assertEquals(null, driver.getDriverClass()); assertEquals(null, driver.getXaDataSourceClass()); assertEquals(STR, driver.getDataSourceClass()); driver = ds.getDriver("pg"); assertNotNull(driver); assertTrue(drivers.contains(driver)); assertEquals(9, (int)driver.getMajorVersion()); assertEquals(1, (int)driver.getMinorVersion()); assertEquals(STR, driver.getModule()); assertEquals(STR, driver.getDriverClass()); assertEquals(STR, driver.getXaDataSourceClass()); assertEquals(null, driver.getDataSourceClass()); }
/** * Checks the data source parsed * @param result of data source parsing */
Checks the data source parsed
checkDS
{ "repo_name": "darranl/ironjacamar", "path": "testsuite/src/test/java/org/ironjacamar/common/metadata/ds/DataSources13TestCase.java", "license": "epl-1.0", "size": 16741 }
[ "java.util.List", "java.util.Map", "org.ironjacamar.common.api.metadata.common.Capacity", "org.ironjacamar.common.api.metadata.common.Credential", "org.ironjacamar.common.api.metadata.common.Extension", "org.ironjacamar.common.api.metadata.common.FlushStrategy", "org.ironjacamar.common.api.metadata.comm...
import java.util.List; import java.util.Map; import org.ironjacamar.common.api.metadata.common.Capacity; import org.ironjacamar.common.api.metadata.common.Credential; import org.ironjacamar.common.api.metadata.common.Extension; import org.ironjacamar.common.api.metadata.common.FlushStrategy; import org.ironjacamar.common.api.metadata.common.Recovery; import org.ironjacamar.common.api.metadata.ds.DataSource; import org.ironjacamar.common.api.metadata.ds.DataSources; import org.ironjacamar.common.api.metadata.ds.Driver; import org.ironjacamar.common.api.metadata.ds.DsPool; import org.ironjacamar.common.api.metadata.ds.DsSecurity; import org.ironjacamar.common.api.metadata.ds.DsXaPool; import org.ironjacamar.common.api.metadata.ds.Statement; import org.ironjacamar.common.api.metadata.ds.Timeout; import org.ironjacamar.common.api.metadata.ds.TransactionIsolation; import org.ironjacamar.common.api.metadata.ds.Validation; import org.ironjacamar.common.api.metadata.ds.XaDataSource; import org.junit.Assert;
import java.util.*; import org.ironjacamar.common.api.metadata.common.*; import org.ironjacamar.common.api.metadata.ds.*; import org.junit.*;
[ "java.util", "org.ironjacamar.common", "org.junit" ]
java.util; org.ironjacamar.common; org.junit;
1,590,438
public String getTextCase(String index) { Element caseElem = getCellElement(mxVsdxConstants.CASE, index, mxVsdxConstants.CHARACTER); return getValue(caseElem, ""); }
String function(String index) { Element caseElem = getCellElement(mxVsdxConstants.CASE, index, mxVsdxConstants.CHARACTER); return getValue(caseElem, ""); }
/** * Returns the case property of one text fragment * @param charIX IX attribute of Char element * @return Integer value of the Case element */
Returns the case property of one text fragment
getTextCase
{ "repo_name": "flyingCloudRain/drawio", "path": "src/com/mxgraph/io/vsdx/Style.java", "license": "apache-2.0", "size": 31639 }
[ "org.w3c.dom.Element" ]
import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,250,023
public static String hmacMd5Hex(final String key, final String valueToDigest) { return Hex.encodeHexString(hmacMd5(key, valueToDigest)); } // hmacSha1
static String function(final String key, final String valueToDigest) { return Hex.encodeHexString(hmacMd5(key, valueToDigest)); }
/** * Returns a HmacMD5 Message Authentication Code (MAC) as a hex string (lowercase) for the given key and value. * * @param key * They key for the keyed digest (must not be null) * @param valueToDigest * The value (data) which should to digest (maybe empty or null) * @return HmacMD5 MAC for the given key and value as a hex string (lowercase) * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid. */
Returns a HmacMD5 Message Authentication Code (MAC) as a hex string (lowercase) for the given key and value
hmacMd5Hex
{ "repo_name": "MaxCDN/java-maxcdn", "path": "src/org/apache/commons/codec/digest/HmacUtils.java", "license": "mit", "size": 34353 }
[ "org.apache.commons.codec.binary.Hex" ]
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.binary.*;
[ "org.apache.commons" ]
org.apache.commons;
2,269,663
static boolean hasNoCriteria(Command command) { if(command instanceof Query) { Query query = (Query) command; return query.getCriteria() == null; } if (command instanceof Delete) { Delete query = (Delete) command; return query.getCriteria() == null; } if (command instanceof Update) { Update query = (Update) command; return query.getCriteria() == null; } if (command instanceof SetQuery) { SetQuery query = (SetQuery)command; return hasNoCriteria(query.getLeftQuery()) || hasNoCriteria(query.getRightQuery()); } return false; }
static boolean hasNoCriteria(Command command) { if(command instanceof Query) { Query query = (Query) command; return query.getCriteria() == null; } if (command instanceof Delete) { Delete query = (Delete) command; return query.getCriteria() == null; } if (command instanceof Update) { Update query = (Update) command; return query.getCriteria() == null; } if (command instanceof SetQuery) { SetQuery query = (SetQuery)command; return hasNoCriteria(query.getLeftQuery()) hasNoCriteria(query.getRightQuery()); } return false; }
/** * Determine whether a command is a query without a criteria * @param command * @return */
Determine whether a command is a query without a criteria
hasNoCriteria
{ "repo_name": "jagazee/teiid-8.7", "path": "engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleValidateWhereAll.java", "license": "lgpl-2.1", "size": 4275 }
[ "org.teiid.query.sql.lang.Command", "org.teiid.query.sql.lang.Delete", "org.teiid.query.sql.lang.Query", "org.teiid.query.sql.lang.SetQuery", "org.teiid.query.sql.lang.Update" ]
import org.teiid.query.sql.lang.Command; import org.teiid.query.sql.lang.Delete; import org.teiid.query.sql.lang.Query; import org.teiid.query.sql.lang.SetQuery; import org.teiid.query.sql.lang.Update;
import org.teiid.query.sql.lang.*;
[ "org.teiid.query" ]
org.teiid.query;
2,680,822
Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids, AclService aclService);
Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids, AclService aclService);
/** * Perform an optimized ACL lookup. * * <p>Implementing classes must not throw * {@link org.springframework.security.acls.model.NotFoundException}, nor * any other kind of exception if an ObjectIdentity cannot be retrieved. * * @param objects the identities to lookup (required) * @param sids the SIDs for which identities are required (may be {@code null}, implementations may elect not to provide SID optimizations) * * @return a Map where keys represent the {@link ObjectIdentity} of the located {@link Acl} and values * are the located {@link Acl} (never {@code null} although some entries may be missing) */
Perform an optimized ACL lookup. Implementing classes must not throw <code>org.springframework.security.acls.model.NotFoundException</code>, nor any other kind of exception if an ObjectIdentity cannot be retrieved
readAclsById
{ "repo_name": "libreworks/stellarbase", "path": "stellarbase-security/src/main/java/com/libreworks/stellarbase/security/acl/RecursiveLookupStrategy.java", "license": "apache-2.0", "size": 2003 }
[ "java.util.List", "java.util.Map", "org.springframework.security.acls.model.Acl", "org.springframework.security.acls.model.AclService", "org.springframework.security.acls.model.ObjectIdentity", "org.springframework.security.acls.model.Sid" ]
import java.util.List; import java.util.Map; import org.springframework.security.acls.model.Acl; import org.springframework.security.acls.model.AclService; import org.springframework.security.acls.model.ObjectIdentity; import org.springframework.security.acls.model.Sid;
import java.util.*; import org.springframework.security.acls.model.*;
[ "java.util", "org.springframework.security" ]
java.util; org.springframework.security;
567,340
public void put(int resourceId, Object data) { if (mData == null) { mData = new SparseArray<Object>(); } mData.put(resourceId, data); }
void function(int resourceId, Object data) { if (mData == null) { mData = new SparseArray<Object>(); } mData.put(resourceId, data); }
/** * Adds a mapping from the specified id to the specified value, replacing the previous * mapping from the specified key if there was one. * * @param resourceId Id of the resource you want to add. It is suggested to use R.id.* to * preserve cross functionality and avoid conflicts. * @param data The data you want to associate with the resourceId. */
Adds a mapping from the specified id to the specified value, replacing the previous mapping from the specified key if there was one
put
{ "repo_name": "amirlotfi/Nikagram", "path": "app/src/main/java/ir/nikagram/messenger/support/widget/RecyclerView.java", "license": "gpl-2.0", "size": 482314 }
[ "android.util.SparseArray" ]
import android.util.SparseArray;
import android.util.*;
[ "android.util" ]
android.util;
23,325
static JvmVisibility getAnnotationTypeDefaultVisibilityIn(EObject container) { if (container instanceof SarlAgent) { return JvmVisibility.PROTECTED; } return JvmVisibility.PUBLIC; }
static JvmVisibility getAnnotationTypeDefaultVisibilityIn(EObject container) { if (container instanceof SarlAgent) { return JvmVisibility.PROTECTED; } return JvmVisibility.PUBLIC; }
/** Replies the default visibility of an annotation type when inside the given container. * * @param container the container. * @return the default visibility. * @since 0.6 */
Replies the default visibility of an annotation type when inside the given container
getAnnotationTypeDefaultVisibilityIn
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/IDefaultVisibilityProvider.java", "license": "apache-2.0", "size": 4644 }
[ "io.sarl.lang.sarl.SarlAgent", "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.common.types.JvmVisibility" ]
import io.sarl.lang.sarl.SarlAgent; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.common.types.JvmVisibility;
import io.sarl.lang.sarl.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.common.types.*;
[ "io.sarl.lang", "org.eclipse.emf", "org.eclipse.xtext" ]
io.sarl.lang; org.eclipse.emf; org.eclipse.xtext;
2,662,663
public DataSet executeQuery(String queryString) throws MetaModelException;
DataSet function(String queryString) throws MetaModelException;
/** * Parses and executes a string-based SQL query. * * This method is essentially equivalent to calling first * {@link #parseQuery(String)} and then {@link #executeQuery(Query)} with * the parsed query. * * @param queryString * the SQL query to parse * @return the {@link DataSet} produced from executing the query * @throws MetaModelException * if either parsing or executing the query produces an * exception */
Parses and executes a string-based SQL query. This method is essentially equivalent to calling first <code>#parseQuery(String)</code> and then <code>#executeQuery(Query)</code> with the parsed query
executeQuery
{ "repo_name": "ClaudiaPHI/metamodel", "path": "core/src/main/java/org/apache/metamodel/DataContext.java", "license": "apache-2.0", "size": 7559 }
[ "org.apache.metamodel.data.DataSet" ]
import org.apache.metamodel.data.DataSet;
import org.apache.metamodel.data.*;
[ "org.apache.metamodel" ]
org.apache.metamodel;
667,124
@Deprecated public static List<BoxFile> getFiles(BoxCollection collection) { List<BoxFile> files = new ArrayList<BoxFile>(); List<BoxTypedObject> list = collection.getEntries(); for (BoxTypedObject object : list) { if (object instanceof BoxFile) { files.add((BoxFile) object); } } return files; }
static List<BoxFile> function(BoxCollection collection) { List<BoxFile> files = new ArrayList<BoxFile>(); List<BoxTypedObject> list = collection.getEntries(); for (BoxTypedObject object : list) { if (object instanceof BoxFile) { files.add((BoxFile) object); } } return files; }
/** * Get files in a collection.Deprecated, use Utils.getTypedObjects instead. * * @param collection * collection * @return list of files */
Get files in a collection.Deprecated, use Utils.getTypedObjects instead
getFiles
{ "repo_name": "shelsonjava/box-java-sdk-v2", "path": "BoxJavaLibraryV2/src/com/box/boxjavalibv2/resourcemanagers/BoxFilesManagerImpl.java", "license": "apache-2.0", "size": 11633 }
[ "com.box.boxjavalibv2.dao.BoxCollection", "com.box.boxjavalibv2.dao.BoxFile", "com.box.boxjavalibv2.dao.BoxTypedObject", "java.util.ArrayList", "java.util.List" ]
import com.box.boxjavalibv2.dao.BoxCollection; import com.box.boxjavalibv2.dao.BoxFile; import com.box.boxjavalibv2.dao.BoxTypedObject; import java.util.ArrayList; import java.util.List;
import com.box.boxjavalibv2.dao.*; import java.util.*;
[ "com.box.boxjavalibv2", "java.util" ]
com.box.boxjavalibv2; java.util;
542,379
public void setOwner(final Party value) { owner = value; }
void function(final Party value) { owner = value; }
/** * Sets the organization or class of organization able to create and destroy location instances. * The given value is typically an instance of {@link DefaultOrganisation}. * For an alternative where only the organization name is specified, see {@link #setOwner(CharSequence)}. * * @param value the new owner. */
Sets the organization or class of organization able to create and destroy location instances. The given value is typically an instance of <code>DefaultOrganisation</code>. For an alternative where only the organization name is specified, see <code>#setOwner(CharSequence)</code>
setOwner
{ "repo_name": "Geomatys/sis", "path": "core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java", "license": "apache-2.0", "size": 21886 }
[ "org.opengis.metadata.citation.Party" ]
import org.opengis.metadata.citation.Party;
import org.opengis.metadata.citation.*;
[ "org.opengis.metadata" ]
org.opengis.metadata;
168,611
public DocList getDocList(Query query, Query filter, Sort lsort, int offset, int len) throws IOException { QueryCommand qc = new QueryCommand(); qc.setQuery(query) .setFilterList(filter) .setSort(lsort) .setOffset(offset) .setLen(len); QueryResult qr = new QueryResult(); search(qr,qc); return qr.getDocList(); }
DocList function(Query query, Query filter, Sort lsort, int offset, int len) throws IOException { QueryCommand qc = new QueryCommand(); qc.setQuery(query) .setFilterList(filter) .setSort(lsort) .setOffset(offset) .setLen(len); QueryResult qr = new QueryResult(); search(qr,qc); return qr.getDocList(); }
/** * Returns documents matching both <code>query</code> and <code>filter</code> * and sorted by <code>sort</code>. * <p> * This method is cache aware and may retrieve <code>filter</code> from * the cache or make an insertion into the cache as a result of this call. * <p> * FUTURE: The returned DocList may be retrieved from a cache. * * @param filter may be null * @param lsort criteria by which to sort (if null, query relevance is used) * @param offset offset into the list of documents to return * @param len maximum number of documents to return * @return DocList meeting the specified criteria, should <b>not</b> be modified by the caller. * @throws IOException If there is a low-level I/O error. */
Returns documents matching both <code>query</code> and <code>filter</code> and sorted by <code>sort</code>. This method is cache aware and may retrieve <code>filter</code> from the cache or make an insertion into the cache as a result of this call.
getDocList
{ "repo_name": "yintaoxue/read-open-source-code", "path": "solr-4.10.4/src/org/apache/solr/search/SolrIndexSearcher.java", "license": "apache-2.0", "size": 91126 }
[ "java.io.IOException", "org.apache.lucene.search.Query", "org.apache.lucene.search.Sort" ]
import java.io.IOException; import org.apache.lucene.search.Query; import org.apache.lucene.search.Sort;
import java.io.*; import org.apache.lucene.search.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
1,078,589
private void createBackupRestore(String sourceDb, String targetDb) throws SQLException { // Create the database. con = createAndPopulateDB(sourceDb); validateDBContents(con); CallableStatement cs = con.prepareCall( "CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)"); cs.setString(1, new File(SupportFilesSetup.EXTINOUT, "backups").getPath()); // Perform backup. cs.execute(); con.close(); shutdown(sourceDb); confirmNonBootedDB(sourceDb); // Use the restoreFrom attribute. con = getConnection(targetDb, CORRECT_KEY, ";restoreFrom=" + obtainDbName(sourceDb, "backups")); validateDBContents(con); con.close(); }
void function(String sourceDb, String targetDb) throws SQLException { con = createAndPopulateDB(sourceDb); validateDBContents(con); CallableStatement cs = con.prepareCall( STR); cs.setString(1, new File(SupportFilesSetup.EXTINOUT, STR).getPath()); cs.execute(); con.close(); shutdown(sourceDb); confirmNonBootedDB(sourceDb); con = getConnection(targetDb, CORRECT_KEY, STR + obtainDbName(sourceDb, STR)); validateDBContents(con); con.close(); }
/** * Create encrypted database, validate it, backup, restore and validate * recovered database. * <p> * The source db is shutdown, the recovered db is left booted. * * @param sourceDb the original database to create * @param targetDb the database to recover to */
Create encrypted database, validate it, backup, restore and validate recovered database. The source db is shutdown, the recovered db is left booted
createBackupRestore
{ "repo_name": "scnakandala/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/store/EncryptionKeyTest.java", "license": "apache-2.0", "size": 26162 }
[ "java.io.File", "java.sql.CallableStatement", "java.sql.SQLException", "org.apache.derbyTesting.junit.SupportFilesSetup" ]
import java.io.File; import java.sql.CallableStatement; import java.sql.SQLException; import org.apache.derbyTesting.junit.SupportFilesSetup;
import java.io.*; import java.sql.*; import org.apache.*;
[ "java.io", "java.sql", "org.apache" ]
java.io; java.sql; org.apache;
1,964,695
@DoesServiceRequest public final int downloadRangeToByteArray(final long offset, final Long length, final byte[] buffer, final int bufferOffset) throws StorageException { return this.downloadRangeToByteArray(offset, length, buffer, bufferOffset, null , null , null ); }
final int function(final long offset, final Long length, final byte[] buffer, final int bufferOffset) throws StorageException { return this.downloadRangeToByteArray(offset, length, buffer, bufferOffset, null , null , null ); }
/** * Downloads a range of bytes from the blob to the given byte buffer. * * @param offset * A <code>long</code> which represents the byte offset to use as the starting point for the source. * @param length * A <code>Long</code> which represents the number of bytes to read or null. * @param buffer * A <code>byte</code> array which represents the buffer to which the blob bytes are downloaded. * @param bufferOffset * An <code>int</code> which represents the byte offset to use as the starting point for the target. * @returns The total number of bytes read into the buffer. * * @throws StorageException */
Downloads a range of bytes from the blob to the given byte buffer
downloadRangeToByteArray
{ "repo_name": "emgerner-msft/azure-storage-java", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java", "license": "apache-2.0", "size": 133550 }
[ "com.microsoft.azure.storage.StorageException" ]
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,124,309
@POST @Path("/jstack") public ApiBulkCommandList jstack(ApiRoleNameList roleNames);
@Path(STR) ApiBulkCommandList function(ApiRoleNameList roleNames);
/** * Run the jstack diagnostic command. The command runs the jstack utility to * capture a role's java thread stacks. * <p/> * Available since API v8. * * @param roleNames the names of the roles to jstack. * @return List of submitted commands. */
Run the jstack diagnostic command. The command runs the jstack utility to capture a role's java thread stacks. Available since API v8
jstack
{ "repo_name": "kostin88/cm_api", "path": "java/src/main/java/com/cloudera/api/v8/RoleCommandsResourceV8.java", "license": "apache-2.0", "size": 2741 }
[ "com.cloudera.api.model.ApiBulkCommandList", "com.cloudera.api.model.ApiRoleNameList", "javax.ws.rs.Path" ]
import com.cloudera.api.model.ApiBulkCommandList; import com.cloudera.api.model.ApiRoleNameList; import javax.ws.rs.Path;
import com.cloudera.api.model.*; import javax.ws.rs.*;
[ "com.cloudera.api", "javax.ws" ]
com.cloudera.api; javax.ws;
2,576,616
@Deployment public void testNonInterruptingSignal() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("nonInterruptingSignalEvent"); List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); Task currentTask = tasks.get(0); assertEquals("My User Task", currentTask.getName()); runtimeService.signalEventReceived("alert"); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(2, tasks.size()); for (Task task : tasks) { if (!task.getName().equals("My User Task") && !task.getName().equals("My Second User Task")) { fail("Expected: <My User Task> or <My Second User Task> but was <" + task.getName() + ">."); } } taskService.complete(taskService.createTaskQuery().taskName("My User Task").singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); currentTask = tasks.get(0); assertEquals("My Second User Task", currentTask.getName()); }
void function() { ProcessInstance pi = runtimeService.startProcessInstanceByKey(STR); List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); Task currentTask = tasks.get(0); assertEquals(STR, currentTask.getName()); runtimeService.signalEventReceived("alert"); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(2, tasks.size()); for (Task task : tasks) { if (!task.getName().equals(STR) && !task.getName().equals(STR)) { fail(STR + task.getName() + ">."); } } taskService.complete(taskService.createTaskQuery().taskName(STR).singleResult().getId()); tasks = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).list(); assertEquals(1, tasks.size()); currentTask = tasks.get(0); assertEquals(STR, currentTask.getName()); }
/** * TestCase to reproduce Issue ACT-1344 */
TestCase to reproduce Issue ACT-1344
testNonInterruptingSignal
{ "repo_name": "robsoncardosoti/flowable-engine", "path": "modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/event/signal/SignalEventTest.java", "license": "apache-2.0", "size": 36684 }
[ "java.util.List", "org.flowable.engine.runtime.ProcessInstance", "org.flowable.engine.task.Task" ]
import java.util.List; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.task.Task;
import java.util.*; import org.flowable.engine.runtime.*; import org.flowable.engine.task.*;
[ "java.util", "org.flowable.engine" ]
java.util; org.flowable.engine;
2,119,152
private List<String> parseList(String listStr) { String trimmed = listStr.trim(); if (trimmed.length() < 2) return Collections.emptyList(); String[] items = trimmed.substring(1, trimmed.length() - 1).split(","); List<String> result = new ArrayList<>(); for (String item : items) { String s = item.trim(); if (!s.isEmpty()) { result.add(s); } } return result; }
List<String> function(String listStr) { String trimmed = listStr.trim(); if (trimmed.length() < 2) return Collections.emptyList(); String[] items = trimmed.substring(1, trimmed.length() - 1).split(","); List<String> result = new ArrayList<>(); for (String item : items) { String s = item.trim(); if (!s.isEmpty()) { result.add(s); } } return result; }
/** * parses a string like [a,b,c] */
parses a string like [a,b,c]
parseList
{ "repo_name": "ammagamma/graphhopper", "path": "core/src/main/java/com/graphhopper/storage/GraphHopperStorage.java", "license": "apache-2.0", "size": 15521 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,170,527
String path = file.getAbsolutePath(); String parentPath = path.substring(0, path.lastIndexOf("cache")); File parent = new File(parentPath); FileInputStream in = new FileInputStream(file); ObjectInputStream deSerializer = new ObjectInputStream(in); HybridCache cache; try { cache = (HybridCache) deSerializer.readObject(); cache.setFolder(parent); return cache; } catch (ClassNotFoundException e) { throw new IOException(e); } finally { in.close(); } }
String path = file.getAbsolutePath(); String parentPath = path.substring(0, path.lastIndexOf("cache")); File parent = new File(parentPath); FileInputStream in = new FileInputStream(file); ObjectInputStream deSerializer = new ObjectInputStream(in); HybridCache cache; try { cache = (HybridCache) deSerializer.readObject(); cache.setFolder(parent); return cache; } catch (ClassNotFoundException e) { throw new IOException(e); } finally { in.close(); } }
/** * Tries to load the content of the cache from a file * * @param file * File from which the content is to be loaded * @return A Hybrid cache * @throws IOException if file not found */
Tries to load the content of the cache from a file
loadFromFile
{ "repo_name": "AKSW/LIMES-CORE", "path": "limes-core/src/main/java/org/aksw/limes/core/io/cache/HybridCache.java", "license": "gpl-2.0", "size": 11521 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
886,755
protected boolean containsSavedState(IMemento memento) { return memento.getInteger(TAG_SELECTION_OFFSET) != null && memento.getInteger(TAG_SELECTION_LENGTH) != null; }
boolean function(IMemento memento) { return memento.getInteger(TAG_SELECTION_OFFSET) != null && memento.getInteger(TAG_SELECTION_LENGTH) != null; }
/** * Returns whether the given memento contains saved state * <p> * Subclasses may extend or override this method.</p> * * @param memento the saved state of this editor * @return <code>true</code> if the given memento contains saved state * @since 3.3 */
Returns whether the given memento contains saved state Subclasses may extend or override this method
containsSavedState
{ "repo_name": "xiaguangme/simon_ide_tools", "path": "02.eclipse_enhance/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java", "license": "apache-2.0", "size": 247622 }
[ "org.eclipse.ui.IMemento" ]
import org.eclipse.ui.IMemento;
import org.eclipse.ui.*;
[ "org.eclipse.ui" ]
org.eclipse.ui;
1,030,386
public static <T> TypedQuery<T> createSelectQuery(Filter filter, EntityManager entityManager, Class<T> entityClass, FetchJoinInformation[] fetchJoins, SortOrder... sortOrders) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> cq = builder.createQuery(entityClass); Root<T> root = cq.from(entityClass); boolean distinct = addFetchJoinInformation(root, fetchJoins); cq.select(root); cq.distinct(distinct); Map<String, Object> pars = createParameterMap(); Predicate p = createPredicate(filter, builder, root, pars); if (p != null) { cq.where(p); } cq = addSortInformation(builder, cq, root, sortOrders); TypedQuery<T> query = entityManager.createQuery(cq); setParameters(query, pars); return query; }
static <T> TypedQuery<T> function(Filter filter, EntityManager entityManager, Class<T> entityClass, FetchJoinInformation[] fetchJoins, SortOrder... sortOrders) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> cq = builder.createQuery(entityClass); Root<T> root = cq.from(entityClass); boolean distinct = addFetchJoinInformation(root, fetchJoins); cq.select(root); cq.distinct(distinct); Map<String, Object> pars = createParameterMap(); Predicate p = createPredicate(filter, builder, root, pars); if (p != null) { cq.where(p); } cq = addSortInformation(builder, cq, root, sortOrders); TypedQuery<T> query = entityManager.createQuery(cq); setParameters(query, pars); return query; }
/** * Creates a query that simply selects some objects based on some filter * * @param filter the filter * @param entityManager the entity manager * @param entityClass the entity class * @param sortOrder the sorting information * @return */
Creates a query that simply selects some objects based on some filter
createSelectQuery
{ "repo_name": "opencirclesolutions/dynamo", "path": "dynamo-impl/src/main/java/com/ocs/dynamo/dao/impl/JpaQueryBuilder.java", "license": "apache-2.0", "size": 26582 }
[ "com.ocs.dynamo.dao.FetchJoinInformation", "com.ocs.dynamo.dao.SortOrder", "com.ocs.dynamo.filter.Filter", "java.util.Map", "javax.persistence.EntityManager", "javax.persistence.TypedQuery", "javax.persistence.criteria.CriteriaBuilder", "javax.persistence.criteria.CriteriaQuery", "javax.persistence....
import com.ocs.dynamo.dao.FetchJoinInformation; import com.ocs.dynamo.dao.SortOrder; import com.ocs.dynamo.filter.Filter; import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root;
import com.ocs.dynamo.dao.*; import com.ocs.dynamo.filter.*; import java.util.*; import javax.persistence.*; import javax.persistence.criteria.*;
[ "com.ocs.dynamo", "java.util", "javax.persistence" ]
com.ocs.dynamo; java.util; javax.persistence;
2,715,817
private List loadAllItems(Long sectionId) { return getHibernateTemplate().find( "from ItemData i where i.section.sectionId=" + sectionId); }
List function(Long sectionId) { return getHibernateTemplate().find( STR + sectionId); }
/** * This method return a list of ItemData belings to the section with the * given sectionId * * @param sectionId * @return */
This method return a list of ItemData belings to the section with the given sectionId
loadAllItems
{ "repo_name": "puramshetty/sakai", "path": "samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/AssessmentFacadeQueries.java", "license": "apache-2.0", "size": 95403 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,123,238
public static Element createElement(Document d, String name, String value, boolean isCDATA) { Element e = createElement(d, name); if (isCDATA) e.appendChild(createCDATA(d, value)); else e.appendChild(createText(d, value)); return e; }
static Element function(Document d, String name, String value, boolean isCDATA) { Element e = createElement(d, name); if (isCDATA) e.appendChild(createCDATA(d, value)); else e.appendChild(createText(d, value)); return e; }
/** * Creates a DOM element node with the given name and contents. If indicated * the contents is enclosed in CDATA marks. * * @param d * the "mother" document of the created Element * @param name * the name of the element * @param value * the element's value * @param isCDATA * a flag indicating if this element contains (unformatted) * CDATA. * @return a new DOM Element */
Creates a DOM element node with the given name and contents. If indicated the contents is enclosed in CDATA marks
createElement
{ "repo_name": "muhd7rosli/desmoj", "path": "src/desmoj/extensions/xml/util/XMLHelper.java", "license": "apache-2.0", "size": 9358 }
[ "org.w3c.dom.Document", "org.w3c.dom.Element" ]
import org.w3c.dom.Document; import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,906,547
public int[] getIgnoredGlyphs(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts) throws IndexOutOfBoundsException { return getGlyphs(offset, count, reverseOrder, new NotGlyphTester(ignoreTester), glyphs, counts); }
int[] function(int offset, int count, boolean reverseOrder, GlyphTester ignoreTester, int[] glyphs, int[] counts) throws IndexOutOfBoundsException { return getGlyphs(offset, count, reverseOrder, new NotGlyphTester(ignoreTester), glyphs, counts); }
/** * Obtain <code>count</code> ignored glyphs starting at specified offset from current position. If * <code>reverseOrder</code> is true, then glyphs are returned in reverse order starting at specified offset * and going in reverse towards beginning of input glyph sequence. * @param offset from current position * @param count number of glyphs to obtain * @param reverseOrder true if to obtain in reverse order * @param ignoreTester glyph tester to use to determine which glyphs are ignored (or null, in which case none are ignored) * @param glyphs array to use to fetch glyphs * @param counts int[2] array to receive fetched glyph counts, where counts[0] will * receive the number of glyphs obtained, and counts[1] will receive the number of glyphs * ignored * @return array of glyphs * @throws IndexOutOfBoundsException if offset or count results in an * invalid index into input glyph sequence */
Obtain <code>count</code> ignored glyphs starting at specified offset from current position. If <code>reverseOrder</code> is true, then glyphs are returned in reverse order starting at specified offset and going in reverse towards beginning of input glyph sequence
getIgnoredGlyphs
{ "repo_name": "argv-minus-one/fop", "path": "fop-core/src/main/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java", "license": "apache-2.0", "size": 48186 }
[ "org.apache.fop.complexscripts.util.GlyphTester" ]
import org.apache.fop.complexscripts.util.GlyphTester;
import org.apache.fop.complexscripts.util.*;
[ "org.apache.fop" ]
org.apache.fop;
478,735
public String[] getToolNames() { List<String> ret = resolver.getToolNames(); return ret.toArray(new String[ret.size()]); }
String[] function() { List<String> ret = resolver.getToolNames(); return ret.toArray(new String[ret.size()]); }
/** * returns an array of strings of qualified tool names. */
returns an array of strings of qualified tool names
getToolNames
{ "repo_name": "CSCSI/Triana", "path": "triana-core/src/main/java/org/trianacode/taskgraph/tool/ToolTableImpl.java", "license": "apache-2.0", "size": 14090 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,043,472
public static boolean checkForSharedLibraries(Iterable<TransitiveInfoCollection> deps) { for (TransitiveInfoCollection dep : deps) { PythonSourcesProvider provider = dep.getProvider(PythonSourcesProvider.class); if (provider != null) { if (provider.usesSharedLibraries()) { return true; } } else if (FileType.contains( dep.getProvider(FileProvider.class).getFilesToBuild(), CppFileTypes.SHARED_LIBRARY)) { return true; } } return false; }
static boolean function(Iterable<TransitiveInfoCollection> deps) { for (TransitiveInfoCollection dep : deps) { PythonSourcesProvider provider = dep.getProvider(PythonSourcesProvider.class); if (provider != null) { if (provider.usesSharedLibraries()) { return true; } } else if (FileType.contains( dep.getProvider(FileProvider.class).getFilesToBuild(), CppFileTypes.SHARED_LIBRARY)) { return true; } } return false; }
/** * Returns true if this target has an .so file in its transitive dependency closure. */
Returns true if this target has an .so file in its transitive dependency closure
checkForSharedLibraries
{ "repo_name": "rzagabe/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java", "license": "apache-2.0", "size": 16672 }
[ "com.google.devtools.build.lib.analysis.FileProvider", "com.google.devtools.build.lib.analysis.TransitiveInfoCollection", "com.google.devtools.build.lib.rules.cpp.CppFileTypes", "com.google.devtools.build.lib.util.FileType" ]
import com.google.devtools.build.lib.analysis.FileProvider; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.rules.cpp.CppFileTypes; import com.google.devtools.build.lib.util.FileType;
import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.rules.cpp.*; import com.google.devtools.build.lib.util.*;
[ "com.google.devtools" ]
com.google.devtools;
2,016,416
private Path getExistingFilePath() { // This could be either an absolute or relative path. // TODO(user): Ideally all symbolic links should be relative, consider eliminating the absolute // option. return (useAbsolutePaths ? getAbsolutePath(existingFile, filesystem) : MorePaths.getRelativePath(existingFile, desiredLink.getParent())); }
Path function() { return (useAbsolutePaths ? getAbsolutePath(existingFile, filesystem) : MorePaths.getRelativePath(existingFile, desiredLink.getParent())); }
/** * Get the path to the existing file that should be linked. */
Get the path to the existing file that should be linked
getExistingFilePath
{ "repo_name": "Learn-Android-app/buck", "path": "src/com/facebook/buck/step/fs/SymlinkFileStep.java", "license": "apache-2.0", "size": 2859 }
[ "com.facebook.buck.io.MorePaths", "java.nio.file.Path" ]
import com.facebook.buck.io.MorePaths; import java.nio.file.Path;
import com.facebook.buck.io.*; import java.nio.file.*;
[ "com.facebook.buck", "java.nio" ]
com.facebook.buck; java.nio;
1,261,161
public List<String> getApplications(ImageType image) { List<Object> objList = image.getAdaptorsOrOperatingSystemOrSoftware(); if (objList != null) { // Loop for adaptors tag for (Object obj : objList) { if (obj instanceof SoftwareListType) { return ((SoftwareListType) obj).getApplication(); } } } return null; }
List<String> function(ImageType image) { List<Object> objList = image.getAdaptorsOrOperatingSystemOrSoftware(); if (objList != null) { for (Object obj : objList) { if (obj instanceof SoftwareListType) { return ((SoftwareListType) obj).getApplication(); } } } return null; }
/** * Returns the applications associated to a given image. * * @param image Image description * @return */
Returns the applications associated to a given image
getApplications
{ "repo_name": "mF2C/COMPSs", "path": "compss/runtime/config/xml/resources/src/main/java/es/bsc/compss/types/resources/ResourcesFile.java", "license": "apache-2.0", "size": 130588 }
[ "es.bsc.compss.types.resources.jaxb.ImageType", "es.bsc.compss.types.resources.jaxb.SoftwareListType", "java.util.List" ]
import es.bsc.compss.types.resources.jaxb.ImageType; import es.bsc.compss.types.resources.jaxb.SoftwareListType; import java.util.List;
import es.bsc.compss.types.resources.jaxb.*; import java.util.*;
[ "es.bsc.compss", "java.util" ]
es.bsc.compss; java.util;
56,420
static boolean safeContains(Collection<?> collection, @Nullable Object object) { checkNotNull(collection); try { return collection.contains(object); } catch (ClassCastException e) { return false; } catch (NullPointerException e) { return false; } }
static boolean safeContains(Collection<?> collection, @Nullable Object object) { checkNotNull(collection); try { return collection.contains(object); } catch (ClassCastException e) { return false; } catch (NullPointerException e) { return false; } }
/** * Delegates to {@link Collection#contains}. Returns {@code false} if the * {@code contains} method throws a {@code ClassCastException} or * {@code NullPointerException}. */
Delegates to <code>Collection#contains</code>. Returns false if the contains method throws a ClassCastException or NullPointerException
safeContains
{ "repo_name": "jedyang/guava", "path": "guava/src/com/google/common/collect/Collections2.java", "license": "apache-2.0", "size": 21885 }
[ "com.google.common.base.Preconditions", "java.util.Collection", "javax.annotation.Nullable" ]
import com.google.common.base.Preconditions; import java.util.Collection; import javax.annotation.Nullable;
import com.google.common.base.*; import java.util.*; import javax.annotation.*;
[ "com.google.common", "java.util", "javax.annotation" ]
com.google.common; java.util; javax.annotation;
2,886,782
protected void parseResult(final JSONArray jsonResultData) throws MalformedStratumMessageException { final List<Object> resultData = new ArrayList<>(); int startingIndex = 0; // Skip the subject tuple if its present. if (this.parseOptionalSubjectTuple(jsonResultData)) { startingIndex = 1; } for (int arrayIndex = startingIndex; arrayIndex < jsonResultData.length(); ++arrayIndex) { final Object datum; try { datum = jsonResultData.get(arrayIndex); } catch (JSONException ex) { // Should not happen throw new RuntimeException( "Unexpected exception while retrieving JSON element: " + ex.getMessage(), ex ); } resultData.add(datum); } this.setResultData(resultData); }
void function(final JSONArray jsonResultData) throws MalformedStratumMessageException { final List<Object> resultData = new ArrayList<>(); int startingIndex = 0; if (this.parseOptionalSubjectTuple(jsonResultData)) { startingIndex = 1; } for (int arrayIndex = startingIndex; arrayIndex < jsonResultData.length(); ++arrayIndex) { final Object datum; try { datum = jsonResultData.get(arrayIndex); } catch (JSONException ex) { throw new RuntimeException( STR + ex.getMessage(), ex ); } resultData.add(datum); } this.setResultData(resultData); }
/** * Parses the provided JSON array as a Stratum array result and then populates this result * accordingly with its contents. * * @param jsonResultData * The array of result data to parse. * * @throws MalformedStratumMessageException * If the provided JSON array is not a properly-formed Stratum result or cannot be understood. */
Parses the provided JSON array as a Stratum array result and then populates this result accordingly with its contents
parseResult
{ "repo_name": "GuyPaddock/JStratum", "path": "src/main/java/com/redbottledesign/bitcoin/rpc/stratum/message/ArrayResult.java", "license": "lgpl-3.0", "size": 10576 }
[ "com.redbottledesign.bitcoin.rpc.stratum.MalformedStratumMessageException", "java.util.ArrayList", "java.util.List", "org.json.JSONArray", "org.json.JSONException" ]
import com.redbottledesign.bitcoin.rpc.stratum.MalformedStratumMessageException; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException;
import com.redbottledesign.bitcoin.rpc.stratum.*; import java.util.*; import org.json.*;
[ "com.redbottledesign.bitcoin", "java.util", "org.json" ]
com.redbottledesign.bitcoin; java.util; org.json;
1,429,882
public Inventory buildInventory() { Inventory inventory = Bukkit.createInventory(null, size, getTitle()); inventory.setContents(buildContent()); return inventory; }
Inventory function() { Inventory inventory = Bukkit.createInventory(null, size, getTitle()); inventory.setContents(buildContent()); return inventory; }
/** * create an inventory */
create an inventory
buildInventory
{ "repo_name": "UnknownStudio/UDPLib", "path": "udplib-common/src/main/java/team/unstudio/udpl/_ui/UI.java", "license": "apache-2.0", "size": 4047 }
[ "org.bukkit.Bukkit", "org.bukkit.inventory.Inventory" ]
import org.bukkit.Bukkit; import org.bukkit.inventory.Inventory;
import org.bukkit.*; import org.bukkit.inventory.*;
[ "org.bukkit", "org.bukkit.inventory" ]
org.bukkit; org.bukkit.inventory;
2,318,776
@Test public void testGetConfigurationSchemaVersionsByApplicationToken() throws Exception { List<ConfigurationSchemaDto> configurationSchemas = new ArrayList<ConfigurationSchemaDto>(11); ApplicationDto application = createApplication(tenantAdminDto); loginTenantDeveloper(tenantDeveloperDto.getUsername()); List<ConfigurationSchemaDto> defaultConfigurationSchemas = client.getConfigurationSchemasByAppToken(application.getApplicationToken()); configurationSchemas.addAll(defaultConfigurationSchemas); for (int i = 0; i < 10; i++) { ConfigurationSchemaDto configurationSchema = createConfigurationSchema(application.getId(), null); configurationSchemas.add(configurationSchema); } Collections.sort(configurationSchemas, new IdComparator()); SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationToken(application.getApplicationToken()); List<VersionDto> storedConfigurationSchemas = schemaVersions.getConfigurationSchemaVersions(); Collections.sort(storedConfigurationSchemas, new IdComparator()); Assert.assertEquals(configurationSchemas.size(), storedConfigurationSchemas.size()); for (int i = 0; i < configurationSchemas.size(); i++) { ConfigurationSchemaDto configurationSchema = configurationSchemas.get(i); VersionDto storedConfigurationSchema = storedConfigurationSchemas.get(i); assertSchemasEquals(configurationSchema, storedConfigurationSchema); } }
void function() throws Exception { List<ConfigurationSchemaDto> configurationSchemas = new ArrayList<ConfigurationSchemaDto>(11); ApplicationDto application = createApplication(tenantAdminDto); loginTenantDeveloper(tenantDeveloperDto.getUsername()); List<ConfigurationSchemaDto> defaultConfigurationSchemas = client.getConfigurationSchemasByAppToken(application.getApplicationToken()); configurationSchemas.addAll(defaultConfigurationSchemas); for (int i = 0; i < 10; i++) { ConfigurationSchemaDto configurationSchema = createConfigurationSchema(application.getId(), null); configurationSchemas.add(configurationSchema); } Collections.sort(configurationSchemas, new IdComparator()); SchemaVersions schemaVersions = client.getSchemaVersionsByApplicationToken(application.getApplicationToken()); List<VersionDto> storedConfigurationSchemas = schemaVersions.getConfigurationSchemaVersions(); Collections.sort(storedConfigurationSchemas, new IdComparator()); Assert.assertEquals(configurationSchemas.size(), storedConfigurationSchemas.size()); for (int i = 0; i < configurationSchemas.size(); i++) { ConfigurationSchemaDto configurationSchema = configurationSchemas.get(i); VersionDto storedConfigurationSchema = storedConfigurationSchemas.get(i); assertSchemasEquals(configurationSchema, storedConfigurationSchema); } }
/** * Test get configuration schema versions by application Token. * * @throws Exception the exception */
Test get configuration schema versions by application Token
testGetConfigurationSchemaVersionsByApplicationToken
{ "repo_name": "vtkhir/kaa", "path": "server/node/src/test/java/org/kaaproject/kaa/server/control/ControlServerConfigurationSchemaIT.java", "license": "apache-2.0", "size": 6822 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.junit.Assert", "org.kaaproject.kaa.common.dto.ApplicationDto", "org.kaaproject.kaa.common.dto.ConfigurationSchemaDto", "org.kaaproject.kaa.common.dto.VersionDto", "org.kaaproject.kaa.common.dto.admin.SchemaVersions" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Assert; import org.kaaproject.kaa.common.dto.ApplicationDto; import org.kaaproject.kaa.common.dto.ConfigurationSchemaDto; import org.kaaproject.kaa.common.dto.VersionDto; import org.kaaproject.kaa.common.dto.admin.SchemaVersions;
import java.util.*; import org.junit.*; import org.kaaproject.kaa.common.dto.*; import org.kaaproject.kaa.common.dto.admin.*;
[ "java.util", "org.junit", "org.kaaproject.kaa" ]
java.util; org.junit; org.kaaproject.kaa;
2,044,378
@ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String serviceName, String appName, String domainName);
@ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String serviceName, String appName, String domainName);
/** * Delete the custom domain of one lifecycle application. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param serviceName The name of the Service resource. * @param appName The name of the App resource. * @param domainName The name of the custom domain resource. * @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. */
Delete the custom domain of one lifecycle application
delete
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appplatform/src/main/java/com/azure/resourcemanager/appplatform/fluent/CustomDomainsClient.java", "license": "mit", "size": 34833 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
1,413,879
public static int mapIndexOntoVector(int index,INDArray arr) { int ret = index * arr.size(-1); return ret; }
static int function(int index,INDArray arr) { int ret = index * arr.size(-1); return ret; }
/** * This maps an index of a vector * on to a vector in the matrix that can be used * for indexing in to a tensor * @param index the index to map * @param arr the array to use * for indexing * @return the mapped index */
This maps an index of a vector on to a vector in the matrix that can be used for indexing in to a tensor
mapIndexOntoVector
{ "repo_name": "tamseo/nd4j", "path": "nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java", "license": "apache-2.0", "size": 5101 }
[ "org.nd4j.linalg.api.ndarray.INDArray" ]
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ndarray.*;
[ "org.nd4j.linalg" ]
org.nd4j.linalg;
1,925,841
Set<String> getRelatedFeaturesForOffering(String offering);
Set<String> getRelatedFeaturesForOffering(String offering);
/** * Get the related features associated with the specified offering. * * @param offering * the offering * * @return the related features */
Get the related features associated with the specified offering
getRelatedFeaturesForOffering
{ "repo_name": "ahuarte47/SOS", "path": "core/api/src/main/java/org/n52/sos/cache/ContentCache.java", "license": "gpl-2.0", "size": 25657 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,856,322
public static SamlRegisteredServiceServiceProviderMetadataFacade get(final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredService registeredService, final RequestAbstractType request) { return get(resolver, registeredService, request.getIssuer().getValue()); }
static SamlRegisteredServiceServiceProviderMetadataFacade function(final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredService registeredService, final RequestAbstractType request) { return get(resolver, registeredService, request.getIssuer().getValue()); }
/** * Adapt saml metadata and parse. Acts as a facade. * * @param resolver the resolver * @param registeredService the service * @param request the request * @return the saml metadata adaptor */
Adapt saml metadata and parse. Acts as a facade
get
{ "repo_name": "PetrGasparik/cas", "path": "cas-server-support-saml-idp/src/main/java/org/jasig/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java", "license": "apache-2.0", "size": 9424 }
[ "org.jasig.cas.support.saml.services.SamlRegisteredService", "org.jasig.cas.support.saml.services.idp.metadata.cache.SamlRegisteredServiceCachingMetadataResolver", "org.opensaml.saml.saml2.core.RequestAbstractType" ]
import org.jasig.cas.support.saml.services.SamlRegisteredService; import org.jasig.cas.support.saml.services.idp.metadata.cache.SamlRegisteredServiceCachingMetadataResolver; import org.opensaml.saml.saml2.core.RequestAbstractType;
import org.jasig.cas.support.saml.services.*; import org.jasig.cas.support.saml.services.idp.metadata.cache.*; import org.opensaml.saml.saml2.core.*;
[ "org.jasig.cas", "org.opensaml.saml" ]
org.jasig.cas; org.opensaml.saml;
2,594,128
public boolean copyFolder(String source, String dest, Object console) { return Command.getInstance().copyFolder(new File(source), new File(dest), console); }
boolean function(String source, String dest, Object console) { return Command.getInstance().copyFolder(new File(source), new File(dest), console); }
/** * Copy files and/or folders from source to destination<br/> * <b>NOTE</b>: to copy a single file the file name must be specified in * both source and destination strings. * * @param source The String path of source file/folder * @param dest The String path of destination file/folder * @param console The JTextPane swing component for output * @return True if all file/folder were copied, false when ther's an error * during copying */
Copy files and/or folders from source to destination NOTE: to copy a single file the file name must be specified in both source and destination strings
copyFolder
{ "repo_name": "Corsol/MaNGOSUI-Dev", "path": "src/mangosui/CommandManager.java", "license": "gpl-2.0", "size": 73261 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,533,876
public static String urlRewrite(Exchange exchange, String url, HttpEndpoint endpoint, Producer producer) throws Exception { String answer = null; String relativeUrl; if (endpoint.getUrlRewrite() != null) { // we should use the relative path if possible String baseUrl; relativeUrl = endpoint.getHttpUri().toASCIIString(); if (url.startsWith(relativeUrl)) { baseUrl = url.substring(0, relativeUrl.length()); relativeUrl = url.substring(relativeUrl.length()); } else { baseUrl = null; relativeUrl = url; } // mark it as null if its empty if (ObjectHelper.isEmpty(relativeUrl)) { relativeUrl = null; } String newUrl; if (endpoint.getUrlRewrite() instanceof HttpServletUrlRewrite) { // its servlet based, so we need the servlet request HttpServletRequest request = exchange.getIn().getBody(HttpServletRequest.class); if (request == null) { HttpMessage msg = exchange.getIn(HttpMessage.class); if (msg != null) { request = msg.getRequest(); } } if (request == null) { throw new IllegalArgumentException("UrlRewrite " + endpoint.getUrlRewrite() + " requires the message body to be a" + "HttpServletRequest instance, but was: " + ObjectHelper.className(exchange.getIn().getBody())); } // we need to adapt the context-path to be the path from the endpoint, if it came from a http based endpoint // as eg camel-jetty have hardcoded context-path as / for all its servlets/endpoints // we have the actual context-path stored as a header with the key CamelServletContextPath String contextPath = exchange.getIn().getHeader("CamelServletContextPath", String.class); request = new UrlRewriteHttpServletRequestAdapter(request, contextPath); newUrl = ((HttpServletUrlRewrite) endpoint.getUrlRewrite()).rewrite(url, relativeUrl, producer, request); } else { newUrl = endpoint.getUrlRewrite().rewrite(url, relativeUrl, producer); } if (ObjectHelper.isNotEmpty(newUrl) && newUrl != url) { // we got a new url back, that can either be a new absolute url // or a new relative url if (newUrl.startsWith("http:") || newUrl.startsWith("https:")) { answer = newUrl; } else if (baseUrl != null) { // avoid double // when adding the urls if (baseUrl.endsWith("/") && newUrl.startsWith("/")) { answer = baseUrl + newUrl.substring(1); } else { answer = baseUrl + newUrl; } } else { // use the new url as is answer = newUrl; } if (LOG.isDebugEnabled()) { LOG.debug("Using url rewrite to rewrite from url {} to {} -> {}", new Object[]{relativeUrl != null ? relativeUrl : url, newUrl, answer}); } } } return answer; }
static String function(Exchange exchange, String url, HttpEndpoint endpoint, Producer producer) throws Exception { String answer = null; String relativeUrl; if (endpoint.getUrlRewrite() != null) { String baseUrl; relativeUrl = endpoint.getHttpUri().toASCIIString(); if (url.startsWith(relativeUrl)) { baseUrl = url.substring(0, relativeUrl.length()); relativeUrl = url.substring(relativeUrl.length()); } else { baseUrl = null; relativeUrl = url; } if (ObjectHelper.isEmpty(relativeUrl)) { relativeUrl = null; } String newUrl; if (endpoint.getUrlRewrite() instanceof HttpServletUrlRewrite) { HttpServletRequest request = exchange.getIn().getBody(HttpServletRequest.class); if (request == null) { HttpMessage msg = exchange.getIn(HttpMessage.class); if (msg != null) { request = msg.getRequest(); } } if (request == null) { throw new IllegalArgumentException(STR + endpoint.getUrlRewrite() + STR + STR + ObjectHelper.className(exchange.getIn().getBody())); } String contextPath = exchange.getIn().getHeader(STR, String.class); request = new UrlRewriteHttpServletRequestAdapter(request, contextPath); newUrl = ((HttpServletUrlRewrite) endpoint.getUrlRewrite()).rewrite(url, relativeUrl, producer, request); } else { newUrl = endpoint.getUrlRewrite().rewrite(url, relativeUrl, producer); } if (ObjectHelper.isNotEmpty(newUrl) && newUrl != url) { if (newUrl.startsWith("http:") newUrl.startsWith(STR)) { answer = newUrl; } else if (baseUrl != null) { if (baseUrl.endsWith("/") && newUrl.startsWith("/")) { answer = baseUrl + newUrl.substring(1); } else { answer = baseUrl + newUrl; } } else { answer = newUrl; } if (LOG.isDebugEnabled()) { LOG.debug(STR, new Object[]{relativeUrl != null ? relativeUrl : url, newUrl, answer}); } } } return answer; }
/** * Processes any custom {@link org.apache.camel.component.http4.UrlRewrite}. * * @param exchange the exchange * @param url the url * @param endpoint the http endpoint * @param producer the producer * @return the rewritten url, or <tt>null</tt> to use original url * @throws Exception is thrown if any error during rewriting url */
Processes any custom <code>org.apache.camel.component.http4.UrlRewrite</code>
urlRewrite
{ "repo_name": "shuliangtao/apache-camel-2.13.0-src", "path": "components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java", "license": "apache-2.0", "size": 17640 }
[ "javax.servlet.http.HttpServletRequest", "org.apache.camel.Exchange", "org.apache.camel.Producer", "org.apache.camel.component.http4.HttpEndpoint", "org.apache.camel.component.http4.HttpMessage", "org.apache.camel.component.http4.HttpServletUrlRewrite", "org.apache.camel.util.ObjectHelper" ]
import javax.servlet.http.HttpServletRequest; import org.apache.camel.Exchange; import org.apache.camel.Producer; import org.apache.camel.component.http4.HttpEndpoint; import org.apache.camel.component.http4.HttpMessage; import org.apache.camel.component.http4.HttpServletUrlRewrite; import org.apache.camel.util.ObjectHelper;
import javax.servlet.http.*; import org.apache.camel.*; import org.apache.camel.component.http4.*; import org.apache.camel.util.*;
[ "javax.servlet", "org.apache.camel" ]
javax.servlet; org.apache.camel;
748,140
private static String printTbase(TBase t, int depth) { List<String> fields = Lists.newArrayList(); for (Map.Entry<? extends TFieldIdEnum, FieldMetaData> entry : FieldMetaData.getStructMetaDataMap(t.getClass()).entrySet()) { @SuppressWarnings("unchecked") boolean fieldSet = t.isSet(entry.getKey()); String strValue; if (fieldSet) { @SuppressWarnings("unchecked") Object value = t.getFieldValue(entry.getKey()); strValue = printValue(value, depth); } else { strValue = "not set"; } fields.add(tabs(depth) + entry.getValue().fieldName + ": " + strValue); } return Joiner.on("\n").join(fields); }
static String function(TBase t, int depth) { List<String> fields = Lists.newArrayList(); for (Map.Entry<? extends TFieldIdEnum, FieldMetaData> entry : FieldMetaData.getStructMetaDataMap(t.getClass()).entrySet()) { @SuppressWarnings(STR) boolean fieldSet = t.isSet(entry.getKey()); String strValue; if (fieldSet) { @SuppressWarnings(STR) Object value = t.getFieldValue(entry.getKey()); strValue = printValue(value, depth); } else { strValue = STR; } fields.add(tabs(depth) + entry.getValue().fieldName + STR + strValue); } return Joiner.on("\n").join(fields); }
/** * Prints a TBase. * * @param t The object to print. * @param depth The print nesting level. * @return The pretty-printed version of the TBase. */
Prints a TBase
printTbase
{ "repo_name": "foursquare/commons-old", "path": "src/java/com/twitter/common/thrift/Util.java", "license": "apache-2.0", "size": 6759 }
[ "com.google.common.base.Joiner", "com.google.common.collect.Lists", "java.util.List", "java.util.Map", "org.apache.thrift.TBase", "org.apache.thrift.TFieldIdEnum", "org.apache.thrift.meta_data.FieldMetaData" ]
import com.google.common.base.Joiner; import com.google.common.collect.Lists; import java.util.List; import java.util.Map; import org.apache.thrift.TBase; import org.apache.thrift.TFieldIdEnum; import org.apache.thrift.meta_data.FieldMetaData;
import com.google.common.base.*; import com.google.common.collect.*; import java.util.*; import org.apache.thrift.*; import org.apache.thrift.meta_data.*;
[ "com.google.common", "java.util", "org.apache.thrift" ]
com.google.common; java.util; org.apache.thrift;
266,764
public final void setRenderer(final Chart2D renderer) { final boolean requiresErrorBarCalculation = this.m_renderer != renderer; this.m_renderer = renderer; if (requiresErrorBarCalculation) { this.expandErrorBarBounds(); } }
final void function(final Chart2D renderer) { final boolean requiresErrorBarCalculation = this.m_renderer != renderer; this.m_renderer = renderer; if (requiresErrorBarCalculation) { this.expandErrorBarBounds(); } }
/** * Allows the chart this instance is painted by to register itself. * <p> * This is internally required for synchronization and re-ordering due to * z-Index changes. * <p> * * @param renderer * the chart that paints this instance. */
Allows the chart this instance is painted by to register itself. This is internally required for synchronization and re-ordering due to z-Index changes.
setRenderer
{ "repo_name": "cheshirekow/codebase", "path": "third_party/lcm/lcm-java/jchart2d-code/src/info/monitorenter/gui/chart/traces/ATrace2D.java", "license": "gpl-3.0", "size": 66953 }
[ "info.monitorenter.gui.chart.Chart2D" ]
import info.monitorenter.gui.chart.Chart2D;
import info.monitorenter.gui.chart.*;
[ "info.monitorenter.gui" ]
info.monitorenter.gui;
2,821,681
public void setKeyLayerSizeP(Dimension2D d) { if(keyPane_ != null) { keyPane_.getFirstLayer().setSizeP(d); } }
void function(Dimension2D d) { if(keyPane_ != null) { keyPane_.getFirstLayer().setSizeP(d); } }
/** * Set the size of the key layer in physical coordinates. */
Set the size of the key layer in physical coordinates
setKeyLayerSizeP
{ "repo_name": "luttero/Maud", "path": "src/gov/noaa/pmel/sgt/swing/JGraphicLayout.java", "license": "bsd-3-clause", "size": 32791 }
[ "gov.noaa.pmel.util.Dimension2D" ]
import gov.noaa.pmel.util.Dimension2D;
import gov.noaa.pmel.util.*;
[ "gov.noaa.pmel" ]
gov.noaa.pmel;
873,124
public List<Answer> getAnswers() { return answers; }
List<Answer> function() { return answers; }
/** * Getter for answers to this question * @return List of answers to this question */
Getter for answers to this question
getAnswers
{ "repo_name": "fsi-hska/erstiduell", "path": "src/info/hska/erstiduell/questions/Question.java", "license": "mit", "size": 1847 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
7,580
public void setResourceReaderHandler(ResourceReaderHandler rsHandler) { this.resourceReaderHandler = rsHandler; }
void function(ResourceReaderHandler rsHandler) { this.resourceReaderHandler = rsHandler; }
/** * Set the resource handler to use for file access. * * @param rsHandler */
Set the resource handler to use for file access
setResourceReaderHandler
{ "repo_name": "davidwebster48/jawr-main-repo", "path": "jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java", "license": "apache-2.0", "size": 37490 }
[ "net.jawr.web.resource.handler.reader.ResourceReaderHandler" ]
import net.jawr.web.resource.handler.reader.ResourceReaderHandler;
import net.jawr.web.resource.handler.reader.*;
[ "net.jawr.web" ]
net.jawr.web;
1,735,560
@ParameterizedTest @MethodSource("names") public void test(final String bracketName) throws SQLException, ParseException { final ChallengeDescription challenge = GlobalParameters.getChallengeDescription(getConnection()); assertThat(challenge, notNullValue()); final boolean before = Playoff.isPlayoffBracketUnfinished(getConnection(), getTournament().getTournamentID(), bracketName); assertThat(before, is(true)); Playoff.finishBracket(getConnection(), challenge, getTournament(), bracketName); final boolean after = Playoff.isPlayoffBracketUnfinished(getConnection(), getTournament().getTournamentID(), bracketName); assertThat(after, is(false)); }
@MethodSource("names") void function(final String bracketName) throws SQLException, ParseException { final ChallengeDescription challenge = GlobalParameters.getChallengeDescription(getConnection()); assertThat(challenge, notNullValue()); final boolean before = Playoff.isPlayoffBracketUnfinished(getConnection(), getTournament().getTournamentID(), bracketName); assertThat(before, is(true)); Playoff.finishBracket(getConnection(), challenge, getTournament(), bracketName); final boolean after = Playoff.isPlayoffBracketUnfinished(getConnection(), getTournament().getTournamentID(), bracketName); assertThat(after, is(false)); }
/** * Test that the specified bracket can be finished. * * @param bracketName the bracket to check * @throws SQLException internal test error * @throws ParseException internal test error */
Test that the specified bracket can be finished
test
{ "repo_name": "jpschewe/fll-sw", "path": "src/test/java/fll/web/playoff/UnfinishedTestFinish.java", "license": "gpl-2.0", "size": 2208 }
[ "java.sql.SQLException", "java.text.ParseException", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.junit.jupiter.params.provider.MethodSource" ]
import java.sql.SQLException; import java.text.ParseException; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.params.provider.MethodSource;
import java.sql.*; import java.text.*; import org.hamcrest.*; import org.junit.jupiter.params.provider.*;
[ "java.sql", "java.text", "org.hamcrest", "org.junit.jupiter" ]
java.sql; java.text; org.hamcrest; org.junit.jupiter;
1,647,514
public List<WorkerSlot> getAvailableSlots() { List<WorkerSlot> slots = new ArrayList<>(); for (SupervisorDetails supervisor : this.supervisors.values()) { slots.addAll(this.getAvailableSlots(supervisor)); } return slots; }
List<WorkerSlot> function() { List<WorkerSlot> slots = new ArrayList<>(); for (SupervisorDetails supervisor : this.supervisors.values()) { slots.addAll(this.getAvailableSlots(supervisor)); } return slots; }
/** * Gets all the available slots in the cluster. */
Gets all the available slots in the cluster
getAvailableSlots
{ "repo_name": "alibaba/jstorm", "path": "jstorm-core/src/main/java/backtype/storm/scheduler/Cluster.java", "license": "apache-2.0", "size": 13845 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,420,053
public void add(long value) { if (value > Integer.MAX_VALUE) { add(Integer.MAX_VALUE); } else if (value < Integer.MIN_VALUE) { add(Integer.MIN_VALUE); } else { add((int) value); } } public static class Summary { private final long numSamples; private final float average; private final List<PercentileSummary> percentiles; Summary(long numSamples, float average, List<PercentileSummary> percentiles) { this.numSamples = numSamples; this.average = average; this.percentiles = percentiles; }
void function(long value) { if (value > Integer.MAX_VALUE) { add(Integer.MAX_VALUE); } else if (value < Integer.MIN_VALUE) { add(Integer.MIN_VALUE); } else { add((int) value); } } public static class Summary { private final long numSamples; private final float average; private final List<PercentileSummary> percentiles; Summary(long numSamples, float average, List<PercentileSummary> percentiles) { this.numSamples = numSamples; this.average = average; this.percentiles = percentiles; }
/** * Add a new value to the histogram. * * Note that the value will be clipped to the maximum value available in the Histogram instance. * This method is provided for convenience, but handles the same numeric range as the method which * takes an int. */
Add a new value to the histogram. Note that the value will be clipped to the maximum value available in the Histogram instance. This method is provided for convenience, but handles the same numeric range as the method which takes an int
add
{ "repo_name": "guozhangwang/kafka", "path": "trogdor/src/main/java/org/apache/kafka/trogdor/workload/Histogram.java", "license": "apache-2.0", "size": 6832 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,399,372
public CSTNode set( int index, CSTNode element ) { if( elements == null ) { throw new GroovyBugError( "attempt to set() on a EMPTY Reduction" ); } if( index == 0 && !(element instanceof Token) ) { // // It's not the greatest of design that the interface allows this, but it // is a tradeoff with convenience, and the convenience is more important. throw new GroovyBugError( "attempt to set() a non-Token as root of a Reduction" ); } // // Fill slots with nulls, if necessary. int count = elements.size(); if( index >= count ) { for( int i = count; i <= index; i++ ) { elements.add( null ); } } // // Then set in the element. elements.set( index, element ); return element; }
CSTNode function( int index, CSTNode element ) { if( elements == null ) { throw new GroovyBugError( STR ); } if( index == 0 && !(element instanceof Token) ) { throw new GroovyBugError( STR ); } int count = elements.size(); if( index >= count ) { for( int i = count; i <= index; i++ ) { elements.add( null ); } } elements.set( index, element ); return element; }
/** * Sets an element in at the specified index. */
Sets an element in at the specified index
set
{ "repo_name": "OpenBEL/bel-nav", "path": "tools/groovy/src/src/main/org/codehaus/groovy/syntax/Reduction.java", "license": "apache-2.0", "size": 5490 }
[ "org.codehaus.groovy.GroovyBugError" ]
import org.codehaus.groovy.GroovyBugError;
import org.codehaus.groovy.*;
[ "org.codehaus.groovy" ]
org.codehaus.groovy;
1,041,079
public static SearchResponse assertSearchResponse(SearchRequestBuilder request) { return assertSearchResponse(request.get()); }
static SearchResponse function(SearchRequestBuilder request) { return assertSearchResponse(request.get()); }
/** * Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if * any of the shards threw an exception and if the response is serializeable. */
Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if any of the shards threw an exception and if the response is serializeable
assertSearchResponse
{ "repo_name": "snikch/elasticsearch", "path": "test-framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java", "license": "apache-2.0", "size": 38694 }
[ "org.elasticsearch.action.search.SearchRequestBuilder", "org.elasticsearch.action.search.SearchResponse" ]
import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,473,634
public static String getRootTableName(Class classObj) { String rootTableName = ""; Table tbl = cfg.getClassMapping(classObj.getName()).getRootTable(); if(tbl!=null) { rootTableName = tbl.getName(); } return rootTableName; }
static String function(Class classObj) { String rootTableName = ""; Table tbl = cfg.getClassMapping(classObj.getName()).getRootTable(); if(tbl!=null) { rootTableName = tbl.getName(); } return rootTableName; }
/** * This method will be called to return root table name for the given class. * @param classObj :Class of the object * @return :It returns the root table name associated to the class. */
This method will be called to return root table name for the given class
getRootTableName
{ "repo_name": "NCIP/catissue-dao", "path": "src/edu/wustl/dao/util/HibernateMetaData.java", "license": "bsd-3-clause", "size": 16223 }
[ "org.hibernate.mapping.Table" ]
import org.hibernate.mapping.Table;
import org.hibernate.mapping.*;
[ "org.hibernate.mapping" ]
org.hibernate.mapping;
1,650,618
public byte[] cutFile(File file, long offSet, int size) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(file); fis.skip(offSet); byte[] tmp = new byte[size]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int l = fis.read(tmp); baos.write(tmp, 0, l); return baos.toByteArray(); } finally { fis.close(); } } }
byte[] function(File file, long offSet, int size) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(file); fis.skip(offSet); byte[] tmp = new byte[size]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int l = fis.read(tmp); baos.write(tmp, 0, l); return baos.toByteArray(); } finally { fis.close(); } } }
/** * Cut file slice of length size or less starting from offSet. Less in * case where offset + size < file.length() */
Cut file slice of length size or less starting from offSet. Less in case where offset + size < file.length()
cutFile
{ "repo_name": "dulvac/sling", "path": "testing/samples/integration-tests/src/test/java/org/apache/sling/testing/samples/integrationtests/serverside/sling/post/SlingPostChunkUploadTest.java", "license": "apache-2.0", "size": 21484 }
[ "java.io.ByteArrayOutputStream", "java.io.File", "java.io.FileInputStream", "java.io.IOException" ]
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
860,851
public AggregationType getAggregationTypeFallback() { if ( hasAggregationType() ) { return aggregationType; } else if ( hasValueDimension() && value.getAggregationType() != null ) { return value.getAggregationType(); } return AggregationType.AVERAGE; }
AggregationType function() { if ( hasAggregationType() ) { return aggregationType; } else if ( hasValueDimension() && value.getAggregationType() != null ) { return value.getAggregationType(); } return AggregationType.AVERAGE; }
/** * Returns the aggregation type for this query, first by looking at the * aggregation type of the query, second by looking at the aggregation type * of the value dimension, third by returning AVERAGE; */
Returns the aggregation type for this query, first by looking at the aggregation type of the query, second by looking at the aggregation type of the value dimension, third by returning AVERAGE
getAggregationTypeFallback
{ "repo_name": "uonafya/jphes-core", "path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java", "license": "bsd-3-clause", "size": 27869 }
[ "org.hisp.dhis.analytics.AggregationType" ]
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.*;
[ "org.hisp.dhis" ]
org.hisp.dhis;
934,604
public DialogPlusBuilder setHeader(View view) { this.headerView = view; return this; }
DialogPlusBuilder function(View view) { this.headerView = view; return this; }
/** * Set the header view using a view */
Set the header view using a view
setHeader
{ "repo_name": "luckyliuqi/dialogplus", "path": "dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java", "license": "apache-2.0", "size": 10678 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,382,572
public void commit() throws UnsupportedOperationException, SQLException { try { getLogger().log(Level.FINER, "Commiting changes through delegate..."); queryDelegate.beginTransaction(); for (RowItem item : removedItems.values()) { try { if (!queryDelegate.removeRow(item)) { throw new SQLException( "Removal failed for row with ID: " + item.getId()); } } catch (IllegalArgumentException e) { throw new SQLException( "Removal failed for row with ID: " + item.getId(), e); } } for (RowItem item : modifiedItems) { if (!removedItems.containsKey(item.getId())) { if (queryDelegate.storeRow(item) > 0) { item.commit(); } else { queryDelegate.rollback(); refresh(); throw new ConcurrentModificationException( "Item with the ID '" + item.getId() + "' has been externally modified."); } } } for (RowItem item : addedItems) { queryDelegate.storeRow(item); } queryDelegate.commit(); removedItems.clear(); addedItems.clear(); modifiedItems.clear(); refresh(); if (notificationsEnabled) { CacheFlushNotifier.notifyOfCacheFlush(this); } } catch (SQLException e) { queryDelegate.rollback(); throw e; } catch (OptimisticLockException e) { queryDelegate.rollback(); throw e; } }
void function() throws UnsupportedOperationException, SQLException { try { getLogger().log(Level.FINER, STR); queryDelegate.beginTransaction(); for (RowItem item : removedItems.values()) { try { if (!queryDelegate.removeRow(item)) { throw new SQLException( STR + item.getId()); } } catch (IllegalArgumentException e) { throw new SQLException( STR + item.getId(), e); } } for (RowItem item : modifiedItems) { if (!removedItems.containsKey(item.getId())) { if (queryDelegate.storeRow(item) > 0) { item.commit(); } else { queryDelegate.rollback(); refresh(); throw new ConcurrentModificationException( STR + item.getId() + STR); } } } for (RowItem item : addedItems) { queryDelegate.storeRow(item); } queryDelegate.commit(); removedItems.clear(); addedItems.clear(); modifiedItems.clear(); refresh(); if (notificationsEnabled) { CacheFlushNotifier.notifyOfCacheFlush(this); } } catch (SQLException e) { queryDelegate.rollback(); throw e; } catch (OptimisticLockException e) { queryDelegate.rollback(); throw e; } }
/** * Commits all the changes, additions and removals made to the items of this * container. * * @throws UnsupportedOperationException * @throws SQLException */
Commits all the changes, additions and removals made to the items of this container
commit
{ "repo_name": "Darsstar/framework", "path": "compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java", "license": "apache-2.0", "size": 59919 }
[ "java.sql.SQLException", "java.util.ConcurrentModificationException", "java.util.logging.Level" ]
import java.sql.SQLException; import java.util.ConcurrentModificationException; import java.util.logging.Level;
import java.sql.*; import java.util.*; import java.util.logging.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,782,088
public static MozuClient<com.mozu.api.contracts.productadmin.LocationInventoryCollection> getLocationInventoriesClient(String productCode) throws Exception { return getLocationInventoriesClient( productCode, null, null, null, null, null); }
static MozuClient<com.mozu.api.contracts.productadmin.LocationInventoryCollection> function(String productCode) throws Exception { return getLocationInventoriesClient( productCode, null, null, null, null, null); }
/** * Retrieves all locations for which a product has inventory defined and displays the inventory definition properties of each location. * <p><pre><code> * MozuClient<com.mozu.api.contracts.productadmin.LocationInventoryCollection> mozuClient=GetLocationInventoriesClient( productCode); * client.setBaseAddress(url); * client.executeRequest(); * LocationInventoryCollection locationInventoryCollection = client.Result(); * </code></pre></p> * @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.LocationInventoryCollection> * @see com.mozu.api.contracts.productadmin.LocationInventoryCollection */
Retrieves all locations for which a product has inventory defined and displays the inventory definition properties of each location. <code><code> MozuClient mozuClient=GetLocationInventoriesClient( productCode); client.setBaseAddress(url); client.executeRequest(); LocationInventoryCollection locationInventoryCollection = client.Result(); </code></code>
getLocationInventoriesClient
{ "repo_name": "eileenzhuang1/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/products/LocationInventoryClient.java", "license": "mit", "size": 13817 }
[ "com.mozu.api.MozuClient" ]
import com.mozu.api.MozuClient;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
1,317,598
public Pager<Milestone> getGroupMilestones(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager<Milestone>(this, Milestone.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "milestones")); }
Pager<Milestone> function(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException { return (new Pager<Milestone>(this, Milestone.class, itemsPerPage, null, STR, getGroupIdOrPath(groupIdOrPath), STR)); }
/** * Get a Page of group milestones. * * <pre><code>GitLab Endpoint: GET /groups/:id/milestones</code></pre> * * @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance * @param itemsPerPage The number of Milestone instances that will be fetched per page * @return the milestones associated with the specified group * @throws GitLabApiException if any exception occurs */
Get a Page of group milestones. <code><code>GitLab Endpoint: GET /groups/:id/milestones</code></code>
getGroupMilestones
{ "repo_name": "gmessner/gitlab4j-api", "path": "src/main/java/org/gitlab4j/api/MilestonesApi.java", "license": "mit", "size": 29821 }
[ "org.gitlab4j.api.models.Milestone" ]
import org.gitlab4j.api.models.Milestone;
import org.gitlab4j.api.models.*;
[ "org.gitlab4j.api" ]
org.gitlab4j.api;
1,067,412
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> listDnsServicesNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listDnsServicesNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> function( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listDnsServicesNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of NSX DNS Services. */
Get the next page of items
listDnsServicesNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/implementation/WorkloadNetworksClientImpl.java", "license": "mit", "size": 538828 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsServiceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsServiceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.avs.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,416,628
private Path getCacheDirectory() { return getOutputBase().getChild("action_cache"); }
Path function() { return getOutputBase().getChild(STR); }
/** * Returns path to the cache directory. Path must be inside output base to ensure that users can * run concurrent instances of blaze in different clients without attempting to concurrently write * to the same action cache on disk, which might not be safe. */
Returns path to the cache directory. Path must be inside output base to ensure that users can run concurrent instances of blaze in different clients without attempting to concurrently write to the same action cache on disk, which might not be safe
getCacheDirectory
{ "repo_name": "bazelbuild/bazel", "path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java", "license": "apache-2.0", "size": 12203 }
[ "com.google.devtools.build.lib.vfs.Path" ]
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
792,750
public static String minus(String self, Object target) { if (target instanceof Pattern) { return ((Pattern)target).matcher(self).replaceFirst(""); } String text = toString(target); int index = self.indexOf(text); if (index == -1) return self; int end = index + text.length(); if (self.length() > end) { return self.substring(0, index) + self.substring(end); } return self.substring(0, index); }
static String function(String self, Object target) { if (target instanceof Pattern) { return ((Pattern)target).matcher(self).replaceFirst(""); } String text = toString(target); int index = self.indexOf(text); if (index == -1) return self; int end = index + text.length(); if (self.length() > end) { return self.substring(0, index) + self.substring(end); } return self.substring(0, index); }
/** * Remove a part of a String. This replaces the first occurrence * of target within self with '' and returns the result. If * target is a regex Pattern, the first occurrence of that * pattern will be removed (using regex matching), otherwise * the first occurrence of target.toString() will be removed. * * @param self a String * @param target an object representing the part to remove * @return a String minus the part to be removed * @since 1.0 */
Remove a part of a String. This replaces the first occurrence of target within self with '' and returns the result. If target is a regex Pattern, the first occurrence of that pattern will be removed (using regex matching), otherwise the first occurrence of target.toString() will be removed
minus
{ "repo_name": "mv2a/yajsw", "path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 704164 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,565,679
@Generated @Selector("timeSinceFirstResume") public native double timeSinceFirstResume();
@Selector(STR) native double function();
/** * Time interval since properties. */
Time interval since properties
timeSinceFirstResume
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/glkit/GLKViewController.java", "license": "apache-2.0", "size": 10404 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,776,568
public static String readFile(String file) { File f = new File(file); if (!f.exists()) { DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath() + " does not exist."); throw err; } try { char[] c = new char[(int) f.length()]; FileReader fr = new FileReader(f); fr.read(c); fr.close(); return new String(c).trim(); } catch (IOException ex) { DATA_CONVERSION d = new DATA_CONVERSION(); d.initCause(ex); throw (d); } }
static String function(String file) { File f = new File(file); if (!f.exists()) { DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath() + STR); throw err; } try { char[] c = new char[(int) f.length()]; FileReader fr = new FileReader(f); fr.read(c); fr.close(); return new String(c).trim(); } catch (IOException ex) { DATA_CONVERSION d = new DATA_CONVERSION(); d.initCause(ex); throw (d); } }
/** * Read IOR from the file in the local file system. */
Read IOR from the file in the local file system
readFile
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java", "license": "gpl-2.0", "size": 3873 }
[ "java.io.File", "java.io.FileReader", "java.io.IOException" ]
import java.io.File; import java.io.FileReader; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
340,122
public static void setResourceFinder(ResourceFinder finder) { resourceFinder = finder; }
static void function(ResourceFinder finder) { resourceFinder = finder; }
/** * Sets the {@link ResourceFinder} used by the iterator factory to locate * its file-based resources when configuring the tokenization. This method * should be set prior to calling {@link #setProperties(Properties) * setProperties} to ensure that the resources are accessed correctly. Most * applications will never need to call this method. * * @param finder the resource finder used to find and open file-based * resources */
Sets the <code>ResourceFinder</code> used by the iterator factory to locate its file-based resources when configuring the tokenization. This method should be set prior to calling <code>#setProperties(Properties) setProperties</code> to ensure that the resources are accessed correctly. Most applications will never need to call this method
setResourceFinder
{ "repo_name": "fozziethebeat/S-Space", "path": "src/main/java/edu/ucla/sspace/text/IteratorFactory.java", "license": "gpl-2.0", "size": 19034 }
[ "edu.ucla.sspace.util.ResourceFinder" ]
import edu.ucla.sspace.util.ResourceFinder;
import edu.ucla.sspace.util.*;
[ "edu.ucla.sspace" ]
edu.ucla.sspace;
1,002,118
@Override public TaskEntry findByUuid_First(String uuid, OrderByComparator<TaskEntry> orderByComparator) throws NoSuchEntryException { TaskEntry taskEntry = fetchByUuid_First(uuid, orderByComparator); if (taskEntry != null) { return taskEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchEntryException(msg.toString()); }
TaskEntry function(String uuid, OrderByComparator<TaskEntry> orderByComparator) throws NoSuchEntryException { TaskEntry taskEntry = fetchByUuid_First(uuid, orderByComparator); if (taskEntry != null) { return taskEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchEntryException(msg.toString()); }
/** * Returns the first task entry in the ordered set where uuid = &#63;. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching task entry * @throws NoSuchEntryException if a matching task entry could not be found */
Returns the first task entry in the ordered set where uuid = &#63;
findByUuid_First
{ "repo_name": "moltam89/OWXP", "path": "modules/micro-maintainance-task/micro-maintainance-task-service/src/main/java/com/liferay/micro/maintainance/task/service/persistence/impl/TaskEntryPersistenceImpl.java", "license": "gpl-3.0", "size": 57073 }
[ "com.liferay.micro.maintainance.task.exception.NoSuchEntryException", "com.liferay.micro.maintainance.task.model.TaskEntry", "com.liferay.portal.kernel.util.OrderByComparator", "com.liferay.portal.kernel.util.StringBundler", "com.liferay.portal.kernel.util.StringPool" ]
import com.liferay.micro.maintainance.task.exception.NoSuchEntryException; import com.liferay.micro.maintainance.task.model.TaskEntry; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.micro.maintainance.task.exception.*; import com.liferay.micro.maintainance.task.model.*; import com.liferay.portal.kernel.util.*;
[ "com.liferay.micro", "com.liferay.portal" ]
com.liferay.micro; com.liferay.portal;
1,412,011
@Test public void anSVGExceptionIsThrownIfTheReferencedClipPathIsMissing() { final Attributes attributes = Mockito.mock(Attributes.class); when(attributes.getLength()).thenReturn(1); when(attributes.getQName(0)).thenReturn(PresentationAttributeMapper.CLIP_PATH.getName()); when(attributes.getValue(0)).thenReturn("url(#path)"); final SVGNodeBase element = new SVGNodeBaseMock(attributes, new SVGDocumentDataProvider()); try { getClipPath(element); fail(); } catch (final SVGException e) { assertTrue(e.getMessage().contains("path")); } }
void function() { final Attributes attributes = Mockito.mock(Attributes.class); when(attributes.getLength()).thenReturn(1); when(attributes.getQName(0)).thenReturn(PresentationAttributeMapper.CLIP_PATH.getName()); when(attributes.getValue(0)).thenReturn(STR); final SVGNodeBase element = new SVGNodeBaseMock(attributes, new SVGDocumentDataProvider()); try { getClipPath(element); fail(); } catch (final SVGException e) { assertTrue(e.getMessage().contains("path")); } }
/** * Ensure that no {@link SVGClipPath} will be created if the referenced {@link SVGClipPath} does not exist in the {@link SVGDocumentDataProvider}. */
Ensure that no <code>SVGClipPath</code> will be created if the referenced <code>SVGClipPath</code> does not exist in the <code>SVGDocumentDataProvider</code>
anSVGExceptionIsThrownIfTheReferencedClipPathIsMissing
{ "repo_name": "Xyanid/svgFX", "path": "src/test/java/de/saxsys/svgfx/core/elements/SVGNodeBaseTest.java", "license": "apache-2.0", "size": 10039 }
[ "de.saxsys.svgfx.core.SVGDocumentDataProvider", "de.saxsys.svgfx.core.SVGException", "de.saxsys.svgfx.core.attributes.PresentationAttributeMapper", "org.junit.Assert", "org.mockito.Mockito", "org.xml.sax.Attributes" ]
import de.saxsys.svgfx.core.SVGDocumentDataProvider; import de.saxsys.svgfx.core.SVGException; import de.saxsys.svgfx.core.attributes.PresentationAttributeMapper; import org.junit.Assert; import org.mockito.Mockito; import org.xml.sax.Attributes;
import de.saxsys.svgfx.core.*; import de.saxsys.svgfx.core.attributes.*; import org.junit.*; import org.mockito.*; import org.xml.sax.*;
[ "de.saxsys.svgfx", "org.junit", "org.mockito", "org.xml.sax" ]
de.saxsys.svgfx; org.junit; org.mockito; org.xml.sax;
83,917
public static final XSLTErrorResources loadResourceBundle(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { // first try with the given locale return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try // try to fall back to en_US if we can't load { // Since we can't find the localized property file, // fall back to en_US. return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("pl", "PL")); } catch (MissingResourceException e2) { // Now we are really in trouble. // very bad, definitely very bad...not going to get very far throw new MissingResourceException( "Could not load any resource bundles.", className, ""); } } }
static final XSLTErrorResources function(String className) throws MissingResourceException { Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); try { return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); } catch (MissingResourceException e) { try { return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("pl", "PL")); } catch (MissingResourceException e2) { throw new MissingResourceException( STR, className, ""); } } }
/** * Return a named ResourceBundle for a particular locale. This method mimics the behavior * of ResourceBundle.getBundle(). * * @param className the name of the class that implements the resource bundle. * @return the ResourceBundle * @throws MissingResourceException */
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle()
loadResourceBundle
{ "repo_name": "kcsl/immutability-benchmark", "path": "benchmark-applications/reiminfer-oopsla-2012/source/Xalan/src/org/apache/xalan/res/XSLTErrorResources_pl.java", "license": "mit", "size": 70933 }
[ "java.util.Locale", "java.util.MissingResourceException", "java.util.ResourceBundle" ]
import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
625,922
public void setEnableGcDeletes(boolean enableGcDeletes) { this.enableGcDeletes = enableGcDeletes; } /** * Returns the initial index buffer size. This setting is only read on startup and otherwise controlled * by {@link IndexingMemoryController}
void function(boolean enableGcDeletes) { this.enableGcDeletes = enableGcDeletes; } /** * Returns the initial index buffer size. This setting is only read on startup and otherwise controlled * by {@link IndexingMemoryController}
/** * Enables / disables gc deletes * * @see #isEnableGcDeletes() */
Enables / disables gc deletes
setEnableGcDeletes
{ "repo_name": "njlawton/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java", "license": "apache-2.0", "size": 14268 }
[ "org.elasticsearch.indices.IndexingMemoryController" ]
import org.elasticsearch.indices.IndexingMemoryController;
import org.elasticsearch.indices.*;
[ "org.elasticsearch.indices" ]
org.elasticsearch.indices;
2,868,882
protected void presentUserInfo(IWContext iwc) throws RemoteException { addSeperator(this.iwrb.getLocalizedString("mbe.user_info", "User info")); UserBusiness userService = getUserService(iwc); Table infoTable = new Table(3, 8); infoTable.setCellspacing(4); infoTable.setWidth(Table.HUNDRED_PERCENT); int row = 1; Address primaryAddress = null; UserStatus deceasedStatus = null; Email email = null; if (this.user != null) { primaryAddress = userService.getUsersMainAddress(this.user); deceasedStatus = getUserStatusService(iwc).getDeceasedUserStatus((Integer) this.user.getPrimaryKey()); email = userService.getUserMail(this.user); Text personalID = new Text(PersonalIDFormatter.format(this.user.getPersonalID(), iwc.getCurrentLocale())); personalID.setStyleClass(STYLENAME_TEXT); infoTable.add(personalID, 1, 1); Text name = new Text(new Name(this.user.getFirstName(), this.user.getMiddleName(), this.user.getLastName()).getName(iwc.getCurrentLocale(), true)); name.setStyleClass(STYLENAME_TEXT); infoTable.add(name, 2, 1); if (deceasedStatus != null) { Text deceased = new Text(this.iwrb.getLocalizedString("deceased", "Deceased")); deceased.setStyleClass(STYLENAME_HEADER); infoTable.add(deceased, 1, 6); IWTimestamp stamp = new IWTimestamp(deceasedStatus.getDateFrom()); deceased = new Text(stamp.getLocaleDate(iwc.getCurrentLocale(), IWTimestamp.SHORT)); deceased.setStyleClass(STYLENAME_TEXT); infoTable.add(deceased, 2, 6); } } addToMainPart(infoTable); addToMainPart(Text.getBreak()); // address layout section row++; Commune primaryCommune = null; if (primaryAddress != null) { Text address = new Text(primaryAddress.getStreetAddress()); address.setStyleClass(STYLENAME_TEXT); infoTable.add(address, 2, 2); try { PostalCode postal = primaryAddress.getPostalCode(); if (postal != null) { Text postalCode = new Text(", " + postal.getPostalAddress()); postalCode.setStyleClass(STYLENAME_TEXT); infoTable.add(postalCode, 2, 2); } if (primaryAddress.getCommuneID() > 0) { primaryCommune = primaryAddress.getCommune(); } else { primaryCommune = getCommune(iwc, this.user); } if (primaryCommune != null) { Text communeLabel = new Text(this.iwrb.getLocalizedString("commune", "Commune") + ": "); communeLabel.setStyleClass(STYLENAME_HEADER); infoTable.add(communeLabel, 3, 1); Text commune = new Text(primaryCommune.getCommuneName()); commune.setStyleClass(STYLENAME_TEXT); infoTable.add(commune, 3, 1); } } catch (Exception e2) { } } // phone layout section row++; boolean hasPhone = false; try { Phone phone = userService.getUsersHomePhone(this.user); if (phone != null && phone.getNumber() != null) { hasPhone = true; Text phoneText = new Text(phone.getNumber()); phoneText.setStyleClass(STYLENAME_TEXT); infoTable.add(phoneText, 2, 4); } } catch (NoPhoneFoundException e) { } try { Phone phone = userService.getUsersMobilePhone(this.user); if (phone != null && phone.getNumber() != null) { Text phoneText = new Text(hasPhone ? " / " + phone.getNumber() : phone.getNumber()); phoneText.setStyleClass(STYLENAME_TEXT); infoTable.add(phoneText, 2, 4); } } catch (NoPhoneFoundException e) { } // email layout section row++; if (email != null && email.getEmailAddress() != null) { Link link = new Link(email.getEmailAddress(), "mailto:" + email.getEmailAddress()); link.setStyleClass(STYLENAME_TEXT); infoTable.add(link, 2, 3); } infoTable.setAlignment(3, 8, Table.HORIZONTAL_ALIGN_RIGHT); infoTable.add(getEditButton(iwc, ACTION_EDIT_USER), 3, 8); }
void function(IWContext iwc) throws RemoteException { addSeperator(this.iwrb.getLocalizedString(STR, STR)); UserBusiness userService = getUserService(iwc); Table infoTable = new Table(3, 8); infoTable.setCellspacing(4); infoTable.setWidth(Table.HUNDRED_PERCENT); int row = 1; Address primaryAddress = null; UserStatus deceasedStatus = null; Email email = null; if (this.user != null) { primaryAddress = userService.getUsersMainAddress(this.user); deceasedStatus = getUserStatusService(iwc).getDeceasedUserStatus((Integer) this.user.getPrimaryKey()); email = userService.getUserMail(this.user); Text personalID = new Text(PersonalIDFormatter.format(this.user.getPersonalID(), iwc.getCurrentLocale())); personalID.setStyleClass(STYLENAME_TEXT); infoTable.add(personalID, 1, 1); Text name = new Text(new Name(this.user.getFirstName(), this.user.getMiddleName(), this.user.getLastName()).getName(iwc.getCurrentLocale(), true)); name.setStyleClass(STYLENAME_TEXT); infoTable.add(name, 2, 1); if (deceasedStatus != null) { Text deceased = new Text(this.iwrb.getLocalizedString(STR, STR)); deceased.setStyleClass(STYLENAME_HEADER); infoTable.add(deceased, 1, 6); IWTimestamp stamp = new IWTimestamp(deceasedStatus.getDateFrom()); deceased = new Text(stamp.getLocaleDate(iwc.getCurrentLocale(), IWTimestamp.SHORT)); deceased.setStyleClass(STYLENAME_TEXT); infoTable.add(deceased, 2, 6); } } addToMainPart(infoTable); addToMainPart(Text.getBreak()); row++; Commune primaryCommune = null; if (primaryAddress != null) { Text address = new Text(primaryAddress.getStreetAddress()); address.setStyleClass(STYLENAME_TEXT); infoTable.add(address, 2, 2); try { PostalCode postal = primaryAddress.getPostalCode(); if (postal != null) { Text postalCode = new Text(STR + postal.getPostalAddress()); postalCode.setStyleClass(STYLENAME_TEXT); infoTable.add(postalCode, 2, 2); } if (primaryAddress.getCommuneID() > 0) { primaryCommune = primaryAddress.getCommune(); } else { primaryCommune = getCommune(iwc, this.user); } if (primaryCommune != null) { Text communeLabel = new Text(this.iwrb.getLocalizedString("communeSTRCommune") + STR); communeLabel.setStyleClass(STYLENAME_HEADER); infoTable.add(communeLabel, 3, 1); Text commune = new Text(primaryCommune.getCommuneName()); commune.setStyleClass(STYLENAME_TEXT); infoTable.add(commune, 3, 1); } } catch (Exception e2) { } } row++; boolean hasPhone = false; try { Phone phone = userService.getUsersHomePhone(this.user); if (phone != null && phone.getNumber() != null) { hasPhone = true; Text phoneText = new Text(phone.getNumber()); phoneText.setStyleClass(STYLENAME_TEXT); infoTable.add(phoneText, 2, 4); } } catch (NoPhoneFoundException e) { } try { Phone phone = userService.getUsersMobilePhone(this.user); if (phone != null && phone.getNumber() != null) { Text phoneText = new Text(hasPhone ? STR + phone.getNumber() : phone.getNumber()); phoneText.setStyleClass(STYLENAME_TEXT); infoTable.add(phoneText, 2, 4); } } catch (NoPhoneFoundException e) { } row++; if (email != null && email.getEmailAddress() != null) { Link link = new Link(email.getEmailAddress(), STR + email.getEmailAddress()); link.setStyleClass(STYLENAME_TEXT); infoTable.add(link, 2, 3); } infoTable.setAlignment(3, 8, Table.HORIZONTAL_ALIGN_RIGHT); infoTable.add(getEditButton(iwc, ACTION_EDIT_USER), 3, 8); }
/** * presents the user found by search * * @param iwc * the context */
presents the user found by search
presentUserInfo
{ "repo_name": "idega/is.idega.block.family", "path": "src/java/is/idega/block/family/presentation/UserEditor.java", "license": "gpl-3.0", "size": 71915 }
[ "com.idega.core.contact.data.Email", "com.idega.core.contact.data.Phone", "com.idega.core.location.data.Address", "com.idega.core.location.data.Commune", "com.idega.core.location.data.PostalCode", "com.idega.presentation.IWContext", "com.idega.presentation.Table", "com.idega.presentation.text.Link", ...
import com.idega.core.contact.data.Email; import com.idega.core.contact.data.Phone; import com.idega.core.location.data.Address; import com.idega.core.location.data.Commune; import com.idega.core.location.data.PostalCode; import com.idega.presentation.IWContext; import com.idega.presentation.Table; import com.idega.presentation.text.Link; import com.idega.presentation.text.Text; import com.idega.user.business.NoPhoneFoundException; import com.idega.user.business.UserBusiness; import com.idega.user.data.UserStatus; import com.idega.util.IWTimestamp; import com.idega.util.PersonalIDFormatter; import com.idega.util.text.Name; import java.rmi.RemoteException;
import com.idega.core.contact.data.*; import com.idega.core.location.data.*; import com.idega.presentation.*; import com.idega.presentation.text.*; import com.idega.user.business.*; import com.idega.user.data.*; import com.idega.util.*; import com.idega.util.text.*; import java.rmi.*;
[ "com.idega.core", "com.idega.presentation", "com.idega.user", "com.idega.util", "java.rmi" ]
com.idega.core; com.idega.presentation; com.idega.user; com.idega.util; java.rmi;
2,205,363
public static MatrixAccumulator asSumFunctionAccumulator(final double neutral, final MatrixFunction function) { return new MatrixAccumulator() { private final MatrixAccumulator sumAccumulator = Matrices.asSumAccumulator(neutral);
static MatrixAccumulator function(final double neutral, final MatrixFunction function) { return new MatrixAccumulator() { private final MatrixAccumulator sumAccumulator = Matrices.asSumAccumulator(neutral);
/** * Creates a sum function accumulator, that calculates the sum of all * elements in the matrix after applying given {@code function} to each of them. * * @param neutral the neutral value * @param function the matrix function * * @return a sum function accumulator */
Creates a sum function accumulator, that calculates the sum of all elements in the matrix after applying given function to each of them
asSumFunctionAccumulator
{ "repo_name": "luttero/Maud", "path": "src/org/la4j/Matrices.java", "license": "bsd-3-clause", "size": 23102 }
[ "org.la4j.matrix.functor.MatrixAccumulator", "org.la4j.matrix.functor.MatrixFunction" ]
import org.la4j.matrix.functor.MatrixAccumulator; import org.la4j.matrix.functor.MatrixFunction;
import org.la4j.matrix.functor.*;
[ "org.la4j.matrix" ]
org.la4j.matrix;
552,877
protected Duration getConsoleFlushRate(String[] args) { return findFlagValue(args, GeneralOptions.CONSOLE_FILE_FLUSH_INTERVAL) .map(e -> new DurationConverter().convert(e)) .orElse(GeneralOptions.DEFAULT_CONSOLE_FILE_FLUSH_INTERVAL); }
Duration function(String[] args) { return findFlagValue(args, GeneralOptions.CONSOLE_FILE_FLUSH_INTERVAL) .map(e -> new DurationConverter().convert(e)) .orElse(GeneralOptions.DEFAULT_CONSOLE_FILE_FLUSH_INTERVAL); }
/** * Returns the console flush rate from the flag, if present and valid, or 0 (no flush) otherwise. */
Returns the console flush rate from the flag, if present and valid, or 0 (no flush) otherwise
getConsoleFlushRate
{ "repo_name": "google/copybara", "path": "java/com/google/copybara/Main.java", "license": "apache-2.0", "size": 22859 }
[ "com.google.copybara.jcommander.DurationConverter", "java.time.Duration" ]
import com.google.copybara.jcommander.DurationConverter; import java.time.Duration;
import com.google.copybara.jcommander.*; import java.time.*;
[ "com.google.copybara", "java.time" ]
com.google.copybara; java.time;
539,707
//----------------------------------------------------------------------- public MetaProperty<String> columnSet() { return _columnSet; }
MetaProperty<String> function() { return _columnSet; }
/** * The meta-property for the {@code columnSet} property. * @return the meta-property, not null */
The meta-property for the columnSet property
columnSet
{ "repo_name": "codeaudit/OG-Platform", "path": "projects/OG-Web/src/main/java/com/opengamma/web/analytics/ValueRequirementTargetForCell.java", "license": "apache-2.0", "size": 11491 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
1,877,510
private Integer getSupport(Condition condition) { int support = 0; //Sum all the possible concrete form of the condition List<Condition> possibleConditions = Condition.getConcretes(condition); for(Condition c : possibleConditions) { support += (data.get(c) == null) ? 0 : data.get(c); } return support; }
Integer function(Condition condition) { int support = 0; List<Condition> possibleConditions = Condition.getConcretes(condition); for(Condition c : possibleConditions) { support += (data.get(c) == null) ? 0 : data.get(c); } return support; }
/** * Calculate the support for a given condition. For a condition * containing wildcards, the support is the sum of the support of * all the possible concrete form of the condition * @return Absolute support */
Calculate the support for a given condition. For a condition containing wildcards, the support is the sum of the support of all the possible concrete form of the condition
getSupport
{ "repo_name": "tedgueniche/Random-Bayes-Networks", "path": "src/com/bayesianNetwork/network/Node.java", "license": "mit", "size": 5835 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
281,465
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ReservationSummaryInner>> listSinglePageAsync( String scope, Datagrain grain, String startDate, String endDate, String filter, String reservationId, String reservationOrderId) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (scope == null) { return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); } if (grain == null) { return Mono.error(new IllegalArgumentException("Parameter grain is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, this.client.getApiVersion(), accept, context)) .<PagedResponse<ReservationSummaryInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<ReservationSummaryInner>> function( String scope, Datagrain grain, String startDate, String endDate, String filter, String reservationId, String reservationOrderId) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (scope == null) { return Mono.error(new IllegalArgumentException(STR)); } if (grain == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, this.client.getApiVersion(), accept, context)) .<PagedResponse<ReservationSummaryInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Lists the reservations summaries for the defined scope daily or monthly grain. * * @param scope The scope associated with reservations summaries operations. This includes * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for * BillingProfile scope (modern). * @param grain Can be daily or monthly. * @param startDate Start date. Only applicable when querying with billing profile. * @param endDate End date. Only applicable when querying with billing profile. * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter * supports 'le' and 'ge'. Not applicable when querying with billing profile. * @param reservationId Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific * reservation. * @param reservationOrderId Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific * reservation order. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of listing reservation summaries. */
Lists the reservations summaries for the defined scope daily or monthly grain
listSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesClientImpl.java", "license": "mit", "size": 53960 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner", "com.azure.resourceman...
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; import com.azure.resourcemanager.consumption.models.Datagrain;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.consumption.fluent.models.*; import com.azure.resourcemanager.consumption.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
589,487
static public Point topleft(Rectangle r) { return new Point(left(r), top(r)); }
static Point function(Rectangle r) { return new Point(left(r), top(r)); }
/** * Return the top-left coordinates of a rectangle. */
Return the top-left coordinates of a rectangle
topleft
{ "repo_name": "alternativeTime/GlycanBuilderVaadin7Version", "path": "glycanbuilderv/src/ac/uk/icl/dell/vaadin/glycanbuilder/Geometry.java", "license": "gpl-3.0", "size": 10974 }
[ "java.awt.Point", "java.awt.Rectangle" ]
import java.awt.Point; import java.awt.Rectangle;
import java.awt.*;
[ "java.awt" ]
java.awt;
733,553
@Override public Object addToEnvironment(String propName, Object propVal) throws NamingException { return env.put(propName, propVal); }
Object function(String propName, Object propVal) throws NamingException { return env.put(propName, propVal); }
/** * Adds a new environment property to the environment of this context. If * the property already exists, its value is overwritten. * * @param propName the name of the environment property to add; may not * be null * @param propVal the value of the property to add; may not be null * @exception NamingException if a naming exception is encountered */
Adds a new environment property to the environment of this context. If the property already exists, its value is overwritten
addToEnvironment
{ "repo_name": "deathspeeder/class-guard", "path": "apache-tomcat-7.0.53-src/java/org/apache/naming/resources/BaseDirContext.java", "license": "gpl-2.0", "size": 60989 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
2,813,059
public static MethodTypeDescriptor getMethodDescriptor(UnaryExpression.Operator unary) { switch (unary) { case BITNOT: case NEG: return Descriptors.UNARYNUMBER; default: throw new UnsupportedOperationException(unary.toString()); } }
static MethodTypeDescriptor function(UnaryExpression.Operator unary) { switch (unary) { case BITNOT: case NEG: return Descriptors.UNARYNUMBER; default: throw new UnsupportedOperationException(unary.toString()); } }
/** * Returns the method descriptor for the given unary operator. * * @param unary * the unary operator * @return the method descriptor */
Returns the method descriptor for the given unary operator
getMethodDescriptor
{ "repo_name": "anba/es6draft", "path": "src/main/java/com/github/anba/es6draft/runtime/internal/Bootstrap.java", "license": "mit", "size": 98059 }
[ "com.github.anba.es6draft.ast.UnaryExpression", "com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor" ]
import com.github.anba.es6draft.ast.UnaryExpression; import com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor;
import com.github.anba.es6draft.ast.*; import com.github.anba.es6draft.compiler.assembler.*;
[ "com.github.anba" ]
com.github.anba;
363,997
default boolean append(char value) { return append(F.stringx(value)); }
default boolean append(char value) { return append(F.stringx(value)); }
/** * Adds the specified character value at the end of this {@code List}. * * @param value the character value which should be appended. * @return always true. * @throws UnsupportedOperationException if adding to this {@code List} is not supported. * @throws ClassCastException if the class of the object is inappropriate for this {@code List}. * @throws IllegalArgumentException if the object cannot be added to this {@code List}. */
Adds the specified character value at the end of this List
append
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/interfaces/IASTAppendable.java", "license": "gpl-3.0", "size": 16302 }
[ "org.matheclipse.core.expression.F" ]
import org.matheclipse.core.expression.F;
import org.matheclipse.core.expression.*;
[ "org.matheclipse.core" ]
org.matheclipse.core;
2,822,267
public static Order getMockOrder1() { Order mockOrder = new Order(); mockOrder.setOrderId(1); mockOrder.setPatient(getMockPatient1()); Calendar calendar = Calendar.getInstance(); calendar.set(2015, Calendar.FEBRUARY, 4, 14, 35, 0); mockOrder.setScheduledDate(calendar.getTime()); mockOrder.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); mockOrder.setInstructions("CT ABDOMEN PANCREAS WITH IV CONTRAST"); mockOrder.setVoided(false); return mockOrder; }
static Order function() { Order mockOrder = new Order(); mockOrder.setOrderId(1); mockOrder.setPatient(getMockPatient1()); Calendar calendar = Calendar.getInstance(); calendar.set(2015, Calendar.FEBRUARY, 4, 14, 35, 0); mockOrder.setScheduledDate(calendar.getTime()); mockOrder.setUrgency(Order.Urgency.ON_SCHEDULED_DATE); mockOrder.setInstructions(STR); mockOrder.setVoided(false); return mockOrder; }
/** * Convenience method constructing an order for the tests */
Convenience method constructing an order for the tests
getMockOrder1
{ "repo_name": "openmrs/openmrs-module-radiologydcm4chee", "path": "omod/src/test/java/org/openmrs/module/radiology/test/RadiologyTestData.java", "license": "mpl-2.0", "size": 16295 }
[ "java.util.Calendar", "org.openmrs.Order" ]
import java.util.Calendar; import org.openmrs.Order;
import java.util.*; import org.openmrs.*;
[ "java.util", "org.openmrs" ]
java.util; org.openmrs;
294,340
public void setInternalKettleVariables( VariableSpace var ) { if ( jobMeta != null && jobMeta.getFilename() != null ) { // we have a finename that's defined. try { FileObject fileObject = KettleVFS.getFileObject( jobMeta.getFilename(), this ); FileName fileName = fileObject.getName(); // The filename of the transformation variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName() ); // The directory of the transformation FileName fileDir = fileName.getParent(); variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI() ); } catch ( Exception e ) { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "" ); variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "" ); } } else { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "" ); variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, "" ); } boolean hasRepoDir = jobMeta.getRepositoryDirectory() != null && jobMeta.getRepository() != null; // The name of the job variables.setVariable( Const.INTERNAL_VARIABLE_JOB_NAME, Const.NVL( jobMeta.getName(), "" ) ); // The name of the directory in the repository variables.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, hasRepoDir ? jobMeta .getRepositoryDirectory().getPath() : "" ); // setup fallbacks if ( hasRepoDir ) { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY ) ); } else { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY ) ); } if ( hasRepoDir ) { variables.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY ) ); if ( "/".equals( variables.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ) ) { variables.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "" ); } } else { variables.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY ) ); } }
void function( VariableSpace var ) { if ( jobMeta != null && jobMeta.getFilename() != null ) { try { FileObject fileObject = KettleVFS.getFileObject( jobMeta.getFilename(), this ); FileName fileName = fileObject.getName(); variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_NAME, fileName.getBaseName() ); FileName fileDir = fileName.getParent(); variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, fileDir.getURI() ); } catch ( Exception e ) { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, STR" ); } } else { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, STRSTRSTRSTR/STR" ); } } else { variables.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY ) ); } }
/** * Sets the internal kettle variables. * * @param var * the new internal kettle variables. */
Sets the internal kettle variables
setInternalKettleVariables
{ "repo_name": "emartin-pentaho/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/job/Job.java", "license": "apache-2.0", "size": 71361 }
[ "org.apache.commons.vfs2.FileName", "org.apache.commons.vfs2.FileObject", "org.pentaho.di.core.Const", "org.pentaho.di.core.variables.VariableSpace", "org.pentaho.di.core.vfs.KettleVFS" ]
import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.Const; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.core.vfs.KettleVFS;
import org.apache.commons.vfs2.*; import org.pentaho.di.core.*; import org.pentaho.di.core.variables.*; import org.pentaho.di.core.vfs.*;
[ "org.apache.commons", "org.pentaho.di" ]
org.apache.commons; org.pentaho.di;
1,547,488
@Autowired public void setContext(ApplicationContext context) { this.context = context; ((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope()); ((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope()); }
void function(ApplicationContext context) { this.context = context; ((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope(STR, new SessionScope()); ((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope(STR, new RequestScope()); }
/** * Autowired to set the Spring application context. * */
Autowired to set the Spring application context
setContext
{ "repo_name": "didoux/Spring-BowlingDB", "path": "generated/bowling/web/TeamControllerTest.java", "license": "gpl-2.0", "size": 6362 }
[ "org.springframework.beans.factory.support.DefaultListableBeanFactory", "org.springframework.context.ApplicationContext", "org.springframework.web.context.request.RequestScope", "org.springframework.web.context.request.SessionScope" ]
import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.web.context.request.RequestScope; import org.springframework.web.context.request.SessionScope;
import org.springframework.beans.factory.support.*; import org.springframework.context.*; import org.springframework.web.context.request.*;
[ "org.springframework.beans", "org.springframework.context", "org.springframework.web" ]
org.springframework.beans; org.springframework.context; org.springframework.web;
1,058,293
private void _deleteFile(String path) { File file = new File(path); if (file.exists()) { if (file.isDirectory()) { String[] children = file.list(); for (int i = 0; i < children.length; i++) { new File(file, children[i]).delete(); } } else { file.delete(); } } }
void function(String path) { File file = new File(path); if (file.exists()) { if (file.isDirectory()) { String[] children = file.list(); for (int i = 0; i < children.length; i++) { new File(file, children[i]).delete(); } } else { file.delete(); } } }
/** * Function used to delete the file * * @param path * => file path */
Function used to delete the file
_deleteFile
{ "repo_name": "egovernments/MeGov", "path": "android/src/org/egov/android/view/activity/CreateComplaintActivity.java", "license": "gpl-3.0", "size": 46411 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,531,778
public void testFunctionString() { try { EntityManager em = getEM(); EntityTransaction tx = em.getTransaction(); try { tx.begin(); // Persist an object QueryTypeHolder qt = new QueryTypeHolder(1, 0.0, 100, "MyFirstName"); em.persist(qt); em.flush(); // Perform some FUNCTION queries // FUNCTION in WHERE clause using = operator List result = em.createQuery("SELECT qt FROM QueryTypeHolder qt WHERE FUNCTION('lower', qt.stringValue) = 'myfirstname'").getResultList(); { assertEquals(1, result.size()); QueryTypeHolder qtr = (QueryTypeHolder) result.iterator().next(); assertEquals(1, qtr.getId()); assertEquals("MyFirstName", qtr.getStringValue()); } // FUNCTION in SELECT clause returned result = em.createQuery("SELECT qt.doubleValue, FUNCTION('lower', qt.stringValue) FROM QueryTypeHolder qt").getResultList(); { assertEquals(1, result.size()); Object[] qtr = (Object[]) result.iterator().next(); assertEquals(2, qtr.length); assertEquals(0.0, qtr[0]); assertEquals("myfirstname", qtr[1]); } // FUNCTION in SELECT clause returned as part of CONSTRUCTOR expression result = em.createQuery("SELECT NEW org.datanucleus.samples.annotations.query.QueryTypeResult(qt.doubleValue, qt.longValue, FUNCTION('lower', qt.stringValue)) FROM QueryTypeHolder qt").getResultList(); { assertEquals(1, result.size()); QueryTypeResult qtr = (QueryTypeResult) result.iterator().next(); assertEquals("myfirstname", qtr.getStringValue()); assertEquals(0.0, qtr.getDoubleValue()); assertEquals(100, qtr.getLongValue()); } tx.rollback(); // Dont persist the data } finally { if (tx.isActive()) { tx.rollback(); } em.close(); } } finally { clean(QueryTypeHolder.class); } }
void function() { try { EntityManager em = getEM(); EntityTransaction tx = em.getTransaction(); try { tx.begin(); QueryTypeHolder qt = new QueryTypeHolder(1, 0.0, 100, STR); em.persist(qt); em.flush(); List result = em.createQuery(STR).getResultList(); { assertEquals(1, result.size()); QueryTypeHolder qtr = (QueryTypeHolder) result.iterator().next(); assertEquals(1, qtr.getId()); assertEquals(STR, qtr.getStringValue()); } result = em.createQuery(STR).getResultList(); { assertEquals(1, result.size()); Object[] qtr = (Object[]) result.iterator().next(); assertEquals(2, qtr.length); assertEquals(0.0, qtr[0]); assertEquals(STR, qtr[1]); } result = em.createQuery(STR).getResultList(); { assertEquals(1, result.size()); QueryTypeResult qtr = (QueryTypeResult) result.iterator().next(); assertEquals(STR, qtr.getStringValue()); assertEquals(0.0, qtr.getDoubleValue()); assertEquals(100, qtr.getLongValue()); } tx.rollback(); } finally { if (tx.isActive()) { tx.rollback(); } em.close(); } } finally { clean(QueryTypeHolder.class); } }
/** * Test of use of the JPQL "FUNCTION" function returning String for invoking native SQL functions. */
Test of use of the JPQL "FUNCTION" function returning String for invoking native SQL functions
testFunctionString
{ "repo_name": "datanucleus/tests", "path": "jpa/rdbms/src/test/org/datanucleus/tests/JPQLQueryTest.java", "license": "apache-2.0", "size": 6837 }
[ "java.util.List", "javax.persistence.EntityManager", "javax.persistence.EntityTransaction", "org.datanucleus.samples.annotations.query.QueryTypeHolder", "org.datanucleus.samples.annotations.query.QueryTypeResult" ]
import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.datanucleus.samples.annotations.query.QueryTypeHolder; import org.datanucleus.samples.annotations.query.QueryTypeResult;
import java.util.*; import javax.persistence.*; import org.datanucleus.samples.annotations.query.*;
[ "java.util", "javax.persistence", "org.datanucleus.samples" ]
java.util; javax.persistence; org.datanucleus.samples;
2,675,685
@Override public void prepareLibraryLoad() { if (DEBUG) { Log.i(TAG, "prepareLibraryLoad() called"); } synchronized (mLock) { ensureInitializedLocked(); mPrepareLibraryLoadCalled = true; if (mInBrowserProcess) { // Force generation of random base load address, as well // as creation of shared RELRO sections in this process. setupBaseLoadAddressLocked(); } } }
void function() { if (DEBUG) { Log.i(TAG, STR); } synchronized (mLock) { ensureInitializedLocked(); mPrepareLibraryLoadCalled = true; if (mInBrowserProcess) { setupBaseLoadAddressLocked(); } } }
/** * Call this method just before loading any native shared libraries in this process. */
Call this method just before loading any native shared libraries in this process
prepareLibraryLoad
{ "repo_name": "junhuac/MQUIC", "path": "src/base/android/java/src/org/chromium/base/library_loader/LegacyLinker.java", "license": "mit", "size": 24950 }
[ "org.chromium.base.Log" ]
import org.chromium.base.Log;
import org.chromium.base.*;
[ "org.chromium.base" ]
org.chromium.base;
2,207,106
private static native String createMarker(Element theImage, Element theVehicleImage, int theWidth, int theHeight, String theVehicleImageUrl, int theVehicleLeft, int theVehicleTop, String thePrediction, int theTextLeft, int theTextTop) ;
static native String function(Element theImage, Element theVehicleImage, int theWidth, int theHeight, String theVehicleImageUrl, int theVehicleLeft, int theVehicleTop, String thePrediction, int theTextLeft, int theTextTop) ;
/** * Use HTML canvas to create a vehicle marker with an icon representing the vehicle type as well as a number * representing the number of minutes until that vehicle arrives. */
Use HTML canvas to create a vehicle marker with an icon representing the vehicle type as well as a number representing the number of minutes until that vehicle arrives
createMarker
{ "repo_name": "jamesagnew/whereismystreetcar", "path": "src/ca/wimsc/client/normal/vehicles/VehicleMarkerFactory.java", "license": "apache-2.0", "size": 7248 }
[ "com.google.gwt.dom.client.Element" ]
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
202,095
void touchLastReportedTimeStamp() { this.lastAttemptedOrReportedTime = monotonicNow(); }
void touchLastReportedTimeStamp() { this.lastAttemptedOrReportedTime = monotonicNow(); }
/** * Update lastAttemptedOrReportedTime, so that the expiration time will be * postponed to future. */
Update lastAttemptedOrReportedTime, so that the expiration time will be postponed to future
touchLastReportedTimeStamp
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/sps/StoragePolicySatisfier.java", "license": "apache-2.0", "size": 47210 }
[ "org.apache.hadoop.util.Time" ]
import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,166,688
private boolean overlap(Set ruleRoles, Set userRoles) { if (ruleRoles.contains("any")) { return true; } Iterator i = userRoles.iterator(); while (i.hasNext()) { String role = (String) i.next(); if (ruleRoles.contains(role)) { return true; } } return false; }
boolean function(Set ruleRoles, Set userRoles) { if (ruleRoles.contains("any")) { return true; } Iterator i = userRoles.iterator(); while (i.hasNext()) { String role = (String) i.next(); if (ruleRoles.contains(role)) { return true; } } return false; }
/** * Return true if there is overlap between the two sets. This method merely checks to see if * ruleRoles contains any of the roles listed in userRoles. * * @param ruleRoles * the rule roles * @param userRoles * the user roles * * @return * true, if any roles exist in both Sets. False otherwise. */
Return true if there is overlap between the two sets. This method merely checks to see if ruleRoles contains any of the roles listed in userRoles
overlap
{ "repo_name": "Letractively/owasp-esapi-java", "path": "src/main/java/org/owasp/esapi/reference/accesscontrol/FileBasedACRs.java", "license": "bsd-3-clause", "size": 19175 }
[ "java.util.Iterator", "java.util.Set" ]
import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,540,028
public String toString(int index, int length, Charset charset) { if (length == 0) { return ""; } if (base instanceof byte[]) { return new String((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length, charset); } // direct memory can only be converted to a string using a ByteBuffer return decodeString(toByteBuffer(index, length), charset); }
String function(int index, int length, Charset charset) { if (length == 0) { return ""; } if (base instanceof byte[]) { return new String((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length, charset); } return decodeString(toByteBuffer(index, length), charset); }
/** * Decodes the a portion of this slice into a string with the specified * character set name. */
Decodes the a portion of this slice into a string with the specified character set name
toString
{ "repo_name": "fengshao0907/slice", "path": "src/main/java/io/airlift/slice/Slice.java", "license": "apache-2.0", "size": 38677 }
[ "io.airlift.slice.StringDecoder", "java.nio.charset.Charset" ]
import io.airlift.slice.StringDecoder; import java.nio.charset.Charset;
import io.airlift.slice.*; import java.nio.charset.*;
[ "io.airlift.slice", "java.nio" ]
io.airlift.slice; java.nio;
233,230
public File getPluginsDirectory() { return new File(getRootDirectory(), "plugins"); }
File function() { return new File(getRootDirectory(), STR); }
/** * Gets a File object for the plugins directory of this Instance. * * @return File object for the plugins directory of this Instance */
Gets a File object for the plugins directory of this Instance
getPluginsDirectory
{ "repo_name": "flaw600/ATLauncher", "path": "src/main/java/com/atlauncher/data/Instance.java", "license": "gpl-3.0", "size": 53272 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,650,679
public CmsCategory getCategory(CmsObject cms, String categoryRootPath) throws CmsException { CmsResource resource = cms.readResource(cms.getRequestContext().removeSiteRoot(categoryRootPath)); return getCategory(cms, resource); }
CmsCategory function(CmsObject cms, String categoryRootPath) throws CmsException { CmsResource resource = cms.readResource(cms.getRequestContext().removeSiteRoot(categoryRootPath)); return getCategory(cms, resource); }
/** * Creates a category from the given category root path.<p> * * @param cms the cms context * @param categoryRootPath the category root path * * @return a category object * * @throws CmsException if something goes wrong */
Creates a category from the given category root path
getCategory
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/relations/CmsCategoryService.java", "license": "lgpl-2.1", "size": 36300 }
[ "org.opencms.file.CmsObject", "org.opencms.file.CmsResource", "org.opencms.main.CmsException" ]
import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.main.CmsException;
import org.opencms.file.*; import org.opencms.main.*;
[ "org.opencms.file", "org.opencms.main" ]
org.opencms.file; org.opencms.main;
379,767
public HTTPResponse submitHTTPRequest(HTTPRequest httpRequest, HTTPClientConfiguration httpClientConfiguration, HTTPMethod httpMethod) { // create HTTP client HttpClient httpClient = this.createHttpClient(); // create URL String url = this.createURL(httpRequest, httpClientConfiguration); // create request HttpMethodBase httpMethodClient = this.createMethod(url, httpMethod); // setup header properties this.setupHTTPRequestHeaderProperties(httpRequest, httpMethodClient); // set content this.setRequestContent(httpRequest, httpMethodClient); // get logger LoggerManager loggerManager = LoggerManager.getInstance(); Logger logger = loggerManager.getLogger(); try { logger.logDebug(new Object[] { "Submitting HTTP request: ", httpMethodClient.getURI() }, null); } catch (URIException exception) { logger.logDebug(new Object[] { "Submitting HTTP request" }, null); } String responseContent = null; int statusCode = -1; try { // submit HTTP request statusCode = httpClient.executeMethod(httpMethodClient); if (statusCode >= 400) { throw new FaxException("Error while invoking HTTP request, return status code: " + statusCode); } // get response content responseContent = httpMethodClient.getResponseBodyAsString(); } catch (FaxException exception) { throw exception; } catch (Exception exception) { throw new FaxException("Error while executing HTTP request.", exception); } finally { // release connection httpMethodClient.releaseConnection(); } // create HTTP response HTTPResponse httpResponse = this.createHTTPResponse(statusCode, responseContent); return httpResponse; }
HTTPResponse function(HTTPRequest httpRequest, HTTPClientConfiguration httpClientConfiguration, HTTPMethod httpMethod) { HttpClient httpClient = this.createHttpClient(); String url = this.createURL(httpRequest, httpClientConfiguration); HttpMethodBase httpMethodClient = this.createMethod(url, httpMethod); this.setupHTTPRequestHeaderProperties(httpRequest, httpMethodClient); this.setRequestContent(httpRequest, httpMethodClient); LoggerManager loggerManager = LoggerManager.getInstance(); Logger logger = loggerManager.getLogger(); try { logger.logDebug(new Object[] { STR, httpMethodClient.getURI() }, null); } catch (URIException exception) { logger.logDebug(new Object[] { STR }, null); } String responseContent = null; int statusCode = -1; try { statusCode = httpClient.executeMethod(httpMethodClient); if (statusCode >= 400) { throw new FaxException(STR + statusCode); } responseContent = httpMethodClient.getResponseBodyAsString(); } catch (FaxException exception) { throw exception; } catch (Exception exception) { throw new FaxException(STR, exception); } finally { httpMethodClient.releaseConnection(); } HTTPResponse httpResponse = this.createHTTPResponse(statusCode, responseContent); return httpResponse; }
/** * Submits the HTTP request and returns the HTTP response. * * @param httpRequest * The HTTP request to send * @param httpClientConfiguration * HTTP client configuration * @param httpMethod * The HTTP method to use * @return The HTTP response */
Submits the HTTP request and returns the HTTP response
submitHTTPRequest
{ "repo_name": "sagiegurari/fax4j", "path": "src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java", "license": "apache-2.0", "size": 15940 }
[ "org.apache.commons.httpclient.HttpClient", "org.apache.commons.httpclient.HttpMethodBase", "org.apache.commons.httpclient.URIException", "org.fax4j.FaxException", "org.fax4j.common.Logger", "org.fax4j.common.LoggerManager" ]
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.URIException; import org.fax4j.FaxException; import org.fax4j.common.Logger; import org.fax4j.common.LoggerManager;
import org.apache.commons.httpclient.*; import org.fax4j.*; import org.fax4j.common.*;
[ "org.apache.commons", "org.fax4j", "org.fax4j.common" ]
org.apache.commons; org.fax4j; org.fax4j.common;
2,517,257
public static String[] getAliasedLHSColumnNames( AssociationType associationType, String columnQualifier, int propertyIndex, int begin, OuterJoinLoadable lhsPersister, Mapping mapping) { if ( associationType.useLHSPrimaryKey() ) { return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() ); } else { final String propertyName = associationType.getLHSPropertyName(); if ( propertyName == null ) { return ArrayHelper.slice( toColumns( lhsPersister, columnQualifier, propertyIndex ), begin, associationType.getColumnSpan( mapping ) ); } else { //bad cast return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName ); } } }
static String[] function( AssociationType associationType, String columnQualifier, int propertyIndex, int begin, OuterJoinLoadable lhsPersister, Mapping mapping) { if ( associationType.useLHSPrimaryKey() ) { return StringHelper.qualify( columnQualifier, lhsPersister.getIdentifierColumnNames() ); } else { final String propertyName = associationType.getLHSPropertyName(); if ( propertyName == null ) { return ArrayHelper.slice( toColumns( lhsPersister, columnQualifier, propertyIndex ), begin, associationType.getColumnSpan( mapping ) ); } else { return ( (PropertyMapping) lhsPersister ).toColumns( columnQualifier, propertyName ); } } }
/** * Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join * * @param associationType The association type for the association that represents the join * @param columnQualifier The left-hand side table alias * @param propertyIndex The index of the property that represents the association/join * @param begin The index for any nested (composites) attributes * @param lhsPersister The persister for the left-hand side of the association/join * @param mapping The mapping (typically the SessionFactory). * * @return The qualified column names. */
Get the qualified (prefixed by alias) names of the columns of the owning entity which are to be used in the join
getAliasedLHSColumnNames
{ "repo_name": "1fechner/FeatureExtractor", "path": "sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/main/java/org/hibernate/engine/internal/JoinHelper.java", "license": "lgpl-2.1", "size": 7952 }
[ "org.hibernate.engine.spi.Mapping", "org.hibernate.internal.util.StringHelper", "org.hibernate.internal.util.collections.ArrayHelper", "org.hibernate.persister.entity.OuterJoinLoadable", "org.hibernate.persister.entity.PropertyMapping", "org.hibernate.type.AssociationType" ]
import org.hibernate.engine.spi.Mapping; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.persister.entity.PropertyMapping; import org.hibernate.type.AssociationType;
import org.hibernate.engine.spi.*; import org.hibernate.internal.util.*; import org.hibernate.internal.util.collections.*; import org.hibernate.persister.entity.*; import org.hibernate.type.*;
[ "org.hibernate.engine", "org.hibernate.internal", "org.hibernate.persister", "org.hibernate.type" ]
org.hibernate.engine; org.hibernate.internal; org.hibernate.persister; org.hibernate.type;
934,436
@Test public void testGetScanner_WithRegionClosed() throws IOException { byte[] fam1 = Bytes.toBytes("fam1"); byte[] fam2 = Bytes.toBytes("fam2"); byte[][] families = { fam1, fam2 }; // Setting up region try { this.region = initHRegion(tableName, method, CONF, families); } catch (IOException e) { e.printStackTrace(); fail("Got IOException during initHRegion, " + e.getMessage()); } region.closed.set(true); try { region.getScanner(null); fail("Expected to get an exception during getScanner on a region that is closed"); } catch (NotServingRegionException e) { // this is the correct exception that is expected } catch (IOException e) { fail("Got wrong type of exception - should be a NotServingRegionException, " + "but was an IOException: " + e.getMessage()); } }
void function() throws IOException { byte[] fam1 = Bytes.toBytes("fam1"); byte[] fam2 = Bytes.toBytes("fam2"); byte[][] families = { fam1, fam2 }; try { this.region = initHRegion(tableName, method, CONF, families); } catch (IOException e) { e.printStackTrace(); fail(STR + e.getMessage()); } region.closed.set(true); try { region.getScanner(null); fail(STR); } catch (NotServingRegionException e) { } catch (IOException e) { fail(STR + STR + e.getMessage()); } }
/** * This method tests https://issues.apache.org/jira/browse/HBASE-2516. * * @throws IOException */
This method tests HREF
testGetScanner_WithRegionClosed
{ "repo_name": "mahak/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java", "license": "apache-2.0", "size": 302897 }
[ "java.io.IOException", "org.apache.hadoop.hbase.NotServingRegionException", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Assert" ]
import java.io.IOException; import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
2,897,189
private long calculateCron(CronAgent agent, long time) { Calendar now = new GregorianCalendar(); now.setTimeInMillis(time); int currentYear = now.get(Calendar.YEAR); int currentMonth = now.get(Calendar.MONTH); int currentDay = now.get(Calendar.DAY_OF_MONTH); int currentHour = now.get(Calendar.HOUR_OF_DAY); int currentMinute = now.get(Calendar.MINUTE); Calendar current = null; for (CronTrigger trigger : agent.getCronList()) { int minute = trigger.getMinute().getValue(); int hour = trigger.getHour().getValue(); int day = trigger.getDay().getValue(); int month = trigger.getMonth().getValue(); int year = trigger.getYear().getValue(); if (hour == -1) { hour = currentHour; if (currentMinute >= minute) { if (hour == 23) { hour = 0; } else { hour++; } } } if (day == -1) { day = currentDay; if (currentHour >= hour && currentMinute >= minute) { day++; } } if (month == -1) { month = currentMonth; if (currentDay >= day && currentHour >= hour && currentMinute >= minute) { if (month == 11) { month = 0; } else { month++; } } } else { month--; } if (year == -1) { year = currentYear; if (currentMonth >= month && currentDay >= day && currentHour >= hour && currentMinute >= minute) { year++; } } Calendar next = new GregorianCalendar(year, month, day, hour, minute); if (next.after(now)) { if (current == null || current.after(next)) { current = next; } } } if (current == null) { return -1; } return current.getTimeInMillis(); }
long function(CronAgent agent, long time) { Calendar now = new GregorianCalendar(); now.setTimeInMillis(time); int currentYear = now.get(Calendar.YEAR); int currentMonth = now.get(Calendar.MONTH); int currentDay = now.get(Calendar.DAY_OF_MONTH); int currentHour = now.get(Calendar.HOUR_OF_DAY); int currentMinute = now.get(Calendar.MINUTE); Calendar current = null; for (CronTrigger trigger : agent.getCronList()) { int minute = trigger.getMinute().getValue(); int hour = trigger.getHour().getValue(); int day = trigger.getDay().getValue(); int month = trigger.getMonth().getValue(); int year = trigger.getYear().getValue(); if (hour == -1) { hour = currentHour; if (currentMinute >= minute) { if (hour == 23) { hour = 0; } else { hour++; } } } if (day == -1) { day = currentDay; if (currentHour >= hour && currentMinute >= minute) { day++; } } if (month == -1) { month = currentMonth; if (currentDay >= day && currentHour >= hour && currentMinute >= minute) { if (month == 11) { month = 0; } else { month++; } } } else { month--; } if (year == -1) { year = currentYear; if (currentMonth >= month && currentDay >= day && currentHour >= hour && currentMinute >= minute) { year++; } } Calendar next = new GregorianCalendar(year, month, day, hour, minute); if (next.after(now)) { if (current == null current.after(next)) { current = next; } } } if (current == null) { return -1; } return current.getTimeInMillis(); }
/** * Calculate the time for the cron agent. * * @param agent * the cron agent * @param time * the current time * * @return the time of the next run */
Calculate the time for the cron agent
calculateCron
{ "repo_name": "NABUCCO/org.nabucco.framework.setup", "path": "org.nabucco.framework.setup.impl.component/src/main/man/org/nabucco/framework/setup/impl/component/AgentFactory.java", "license": "epl-1.0", "size": 11708 }
[ "java.util.Calendar", "java.util.GregorianCalendar", "org.nabucco.framework.setup.facade.datatype.agent.CronAgent", "org.nabucco.framework.setup.facade.datatype.agent.CronTrigger" ]
import java.util.Calendar; import java.util.GregorianCalendar; import org.nabucco.framework.setup.facade.datatype.agent.CronAgent; import org.nabucco.framework.setup.facade.datatype.agent.CronTrigger;
import java.util.*; import org.nabucco.framework.setup.facade.datatype.agent.*;
[ "java.util", "org.nabucco.framework" ]
java.util; org.nabucco.framework;
1,334,379
public void extendTwo() { sideSolenoids.set(Relay.Value.kOn); centerSolenoid.set(Relay.Value.kOff); }
void function() { sideSolenoids.set(Relay.Value.kOn); centerSolenoid.set(Relay.Value.kOff); }
/** * Extends the left and right catapult pistons */
Extends the left and right catapult pistons
extendTwo
{ "repo_name": "team2485/frc-2014", "path": "src/team2485/comp/Catapult.java", "license": "bsd-3-clause", "size": 5630 }
[ "edu.wpi.first.wpilibj.Relay" ]
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.*;
[ "edu.wpi.first" ]
edu.wpi.first;
1,525,577
public void preInit() { int count = 4; // ** Update ** m_columnName = new String[count]; m_label = new CLabel[count]; m_from = new VLookup[count]; m_to = new VLookup[count]; // ** Update ** preInit (0, 2163, DisplayType.TableDir, AD_ORG_ID); // C_Order.AD_Org_ID preInit (1, 2762, DisplayType.Search, C_BPARTNER_ID); // C_Order.C_BPartner_ID preInit (2, 971, DisplayType.Search, AD_USER_ID); // AD_User_Roles.AD_User_ID preInit (3, 2221, DisplayType.Search, M_PRODUCT_ID); // C_OrderLine.M_Product_ID } // preInit
void function() { int count = 4; m_columnName = new String[count]; m_label = new CLabel[count]; m_from = new VLookup[count]; m_to = new VLookup[count]; preInit (0, 2163, DisplayType.TableDir, AD_ORG_ID); preInit (1, 2762, DisplayType.Search, C_BPARTNER_ID); preInit (2, 971, DisplayType.Search, AD_USER_ID); preInit (3, 2221, DisplayType.Search, M_PRODUCT_ID); }
/** * Pre Init */
Pre Init
preInit
{ "repo_name": "erpcya/adempierePOS", "path": "client/src/org/compiere/apps/form/VMerge.java", "license": "gpl-2.0", "size": 7625 }
[ "org.compiere.grid.ed.VLookup", "org.compiere.swing.CLabel", "org.compiere.util.DisplayType" ]
import org.compiere.grid.ed.VLookup; import org.compiere.swing.CLabel; import org.compiere.util.DisplayType;
import org.compiere.grid.ed.*; import org.compiere.swing.*; import org.compiere.util.*;
[ "org.compiere.grid", "org.compiere.swing", "org.compiere.util" ]
org.compiere.grid; org.compiere.swing; org.compiere.util;
1,807,654
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.registerTypeWithKryoSerializer(type, serializerClass); }
void function(Class<?> type, Class<? extends Serializer<?>> serializerClass) { config.registerTypeWithKryoSerializer(type, serializerClass); }
/** * Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer. * * @param type The class of the types serialized with the given serializer. * @param serializerClass The class of the serializer to use. */
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer
registerTypeWithKryoSerializer
{ "repo_name": "xiaokuangkuang/kuangjingxiangmu", "path": "flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java", "license": "apache-2.0", "size": 57389 }
[ "com.esotericsoftware.kryo.Serializer" ]
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.*;
[ "com.esotericsoftware.kryo" ]
com.esotericsoftware.kryo;
2,468,823
@Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) throws StatusException { XInterface oObj = null; Object oInterface = null; try { XMultiServiceFactory xMSF = Param.getMSF(); oInterface = xMSF.createInstance( "com.sun.star.i18n.Transliteration" ); } catch( com.sun.star.uno.Exception e ) { log.println("Can't create an object." ); throw new StatusException( "Can't create an object", e ); } oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); return tEnv; } // finish method getTestEnvironment
TestEnvironment function( TestParameters Param, PrintWriter log ) throws StatusException { XInterface oObj = null; Object oInterface = null; try { XMultiServiceFactory xMSF = Param.getMSF(); oInterface = xMSF.createInstance( STR ); } catch( com.sun.star.uno.Exception e ) { log.println(STR ); throw new StatusException( STR, e ); } oObj = (XInterface) oInterface; TestEnvironment tEnv = new TestEnvironment( oObj ); return tEnv; }
/** * Creating a Testenvironment for the interfaces to be tested. * Creates an instance of the service * <code>com.sun.star.i18n.Transliteration</code>. */
Creating a Testenvironment for the interfaces to be tested. Creates an instance of the service <code>com.sun.star.i18n.Transliteration</code>
createTestEnvironment
{ "repo_name": "Limezero/libreoffice", "path": "qadevOOo/tests/java/mod/_i18n/Transliteration.java", "license": "gpl-3.0", "size": 2455 }
[ "com.sun.star.lang.XMultiServiceFactory", "com.sun.star.uno.XInterface", "java.io.PrintWriter" ]
import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.XInterface; import java.io.PrintWriter;
import com.sun.star.lang.*; import com.sun.star.uno.*; import java.io.*;
[ "com.sun.star", "java.io" ]
com.sun.star; java.io;
1,237,111