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 String toString( DateFormat df ); | String function( DateFormat df ); | /**
* Converts entry to string using specified date format.
* @param df
* @return string value of entry
*/ | Converts entry to string using specified date format | toString | {
"repo_name": "OBIGOGIT/etch",
"path": "util/src/main/java/org/apache/etch/util/Log.java",
"license": "apache-2.0",
"size": 37488
} | [
"java.text.DateFormat"
] | import java.text.DateFormat; | import java.text.*; | [
"java.text"
] | java.text; | 1,026,555 |
public void setData(Object data);
public Object getData();
public void buildParameterWidgets(
final Group grp);
| void setData(Object data); public Object getData(); public void function( final Group grp); | /**
* TODO Comment
* @param grp -
* @modified -
*/ | TODO Comment | buildParameterWidgets | {
"repo_name": "tfossi/APolGe",
"path": "src/tfossi/apolge/common/cmd/ICmd.java",
"license": "gpl-3.0",
"size": 5225
} | [
"org.eclipse.swt.widgets.Group"
] | import org.eclipse.swt.widgets.Group; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,824,572 |
public List<INode> getNodeList ( QName name ) ;
| List<INode> function ( QName name ) ; | /**
* Return a list of INode facaded nodes which correspond to the collection
* named name.
* <p>
* Here we look at the children of the current node and return
* that list which matches the name specified.
*
* @param name
* @return a list of such nodes.
*/ | Return a list of INode facaded nodes which correspond to the collection named name. Here we look at the children of the current node and return that list which matches the name specified | getNodeList | {
"repo_name": "Drifftr/devstudio-tooling-bps",
"path": "plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/INode.java",
"license": "apache-2.0",
"size": 6207
} | [
"java.util.List",
"javax.xml.namespace.QName"
] | import java.util.List; import javax.xml.namespace.QName; | import java.util.*; import javax.xml.namespace.*; | [
"java.util",
"javax.xml"
] | java.util; javax.xml; | 941,740 |
private void loadAddress( Address address, List<Modification> mods )
{
if ( address != null )
{
if ( CollectionUtils.isNotEmpty( address.getAddresses() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants
.POSTAL_ADDRESS_AT ) );
for ( String val : address.getAddresses() )
{
mods.add( new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, SchemaConstants
.POSTAL_ADDRESS_AT, val ) );
}
}
if ( StringUtils.isNotEmpty( address.getCity() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.L_AT,
address.getCity() ) );
}
if ( StringUtils.isNotEmpty( address.getPostalCode() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants
.POSTALCODE_AT, address.getPostalCode() ) );
}
if ( StringUtils.isNotEmpty( address.getPostOfficeBox() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants
.POSTOFFICEBOX_AT, address.getPostOfficeBox() ) );
}
if ( StringUtils.isNotEmpty( address.getState() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.ST_AT,
address.getState() ) );
}
if ( StringUtils.isNotEmpty( address.getBuilding() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants
.PHYSICAL_DELIVERY_OFFICE_NAME_AT, address.getBuilding() ) );
}
if ( StringUtils.isNotEmpty( address.getDepartmentNumber() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, DEPARTMENT_NUMBER,
address.getDepartmentNumber() ) );
}
if ( StringUtils.isNotEmpty( address.getRoomNumber() ) )
{
mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, ROOM_NUMBER, address
.getRoomNumber() ) );
}
}
}
/**
* Given an ldap entry containing organzationalPerson address information, convert to {@link Address} | void function( Address address, List<Modification> mods ) { if ( address != null ) { if ( CollectionUtils.isNotEmpty( address.getAddresses() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants .POSTAL_ADDRESS_AT ) ); for ( String val : address.getAddresses() ) { mods.add( new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, SchemaConstants .POSTAL_ADDRESS_AT, val ) ); } } if ( StringUtils.isNotEmpty( address.getCity() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.L_AT, address.getCity() ) ); } if ( StringUtils.isNotEmpty( address.getPostalCode() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants .POSTALCODE_AT, address.getPostalCode() ) ); } if ( StringUtils.isNotEmpty( address.getPostOfficeBox() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants .POSTOFFICEBOX_AT, address.getPostOfficeBox() ) ); } if ( StringUtils.isNotEmpty( address.getState() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants.ST_AT, address.getState() ) ); } if ( StringUtils.isNotEmpty( address.getBuilding() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SchemaConstants .PHYSICAL_DELIVERY_OFFICE_NAME_AT, address.getBuilding() ) ); } if ( StringUtils.isNotEmpty( address.getDepartmentNumber() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, DEPARTMENT_NUMBER, address.getDepartmentNumber() ) ); } if ( StringUtils.isNotEmpty( address.getRoomNumber() ) ) { mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, ROOM_NUMBER, address .getRoomNumber() ) ); } } } /** * Given an ldap entry containing organzationalPerson address information, convert to {@link Address} | /**
* Given an address, {@link Address}, load into ldap modification set in preparation for ldap modify.
*
* @param address contains entity of type {@link Address} targeted for updating into ldap.
* @param mods contains ldap modification set contains attributes to be updated in ldap.
*/ | Given an address, <code>Address</code>, load into ldap modification set in preparation for ldap modify | loadAddress | {
"repo_name": "PennState/directory-fortress-core-1",
"path": "src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java",
"license": "apache-2.0",
"size": 107529
} | [
"java.util.List",
"org.apache.commons.collections.CollectionUtils",
"org.apache.commons.lang.StringUtils",
"org.apache.directory.api.ldap.model.constants.SchemaConstants",
"org.apache.directory.api.ldap.model.entry.DefaultModification",
"org.apache.directory.api.ldap.model.entry.Modification",
"org.apac... | import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.directory.api.ldap.model.constants.SchemaConstants; import org.apache.directory.api.ldap.model.entry.DefaultModification; import org.apache.directory.api.ldap.model.entry.Modification; import org.apache.directory.api.ldap.model.entry.ModificationOperation; import org.apache.directory.fortress.core.model.Address; | import java.util.*; import org.apache.commons.collections.*; import org.apache.commons.lang.*; import org.apache.directory.api.ldap.model.constants.*; import org.apache.directory.api.ldap.model.entry.*; import org.apache.directory.fortress.core.model.*; | [
"java.util",
"org.apache.commons",
"org.apache.directory"
] | java.util; org.apache.commons; org.apache.directory; | 2,455,808 |
public static String addRemoteProcessFile(String destinationType, long spTimeStamp, String spPid, String spLabel) {
LogRepositoryManager destManager = getManager(destinationType) ;
String subProcessFileName = null ;
if (destManager instanceof LogRepositoryManagerImpl)
subProcessFileName = ((LogRepositoryManagerImpl)destManager).addNewFileFromSubProcess(spTimeStamp, spPid, spLabel) ;
return subProcessFileName ;
} | static String function(String destinationType, long spTimeStamp, String spPid, String spLabel) { LogRepositoryManager destManager = getManager(destinationType) ; String subProcessFileName = null ; if (destManager instanceof LogRepositoryManagerImpl) subProcessFileName = ((LogRepositoryManagerImpl)destManager).addNewFileFromSubProcess(spTimeStamp, spPid, spLabel) ; return subProcessFileName ; } | /**
* add a remote file to the cache of files currently considered for retention on the parent. The child process uses
* some form of interProcessCommunication to notify receiver of file creation, and this method is driven
* @param destinationType Type of destination/repository
* @param spTimeStamp timeStamp to be associated with the file
* @param spPid Process Id of the creating process
* @param spLabel Label of the creating process
* @return String with fully qualified name of file to create
*/ | add a remote file to the cache of files currently considered for retention on the parent. The child process uses some form of interProcessCommunication to notify receiver of file creation, and this method is driven | addRemoteProcessFile | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryComponent.java",
"license": "epl-1.0",
"size": 27479
} | [
"com.ibm.ws.logging.hpel.LogRepositoryManager",
"com.ibm.ws.logging.hpel.impl.LogRepositoryManagerImpl"
] | import com.ibm.ws.logging.hpel.LogRepositoryManager; import com.ibm.ws.logging.hpel.impl.LogRepositoryManagerImpl; | import com.ibm.ws.logging.hpel.*; import com.ibm.ws.logging.hpel.impl.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,613,387 |
ArgumentChecker.notNull(futureOptionNumber, "futureOptionNumber");
ArgumentChecker.notNull(strike, "strike");
ArgumentChecker.notNull(surfaceDate, "surface date");
final String prefix = getFutureOptionPrefix();
final StringBuffer ticker = new StringBuffer();
ticker.append(prefix);
final ExchangeTradedInstrumentExpiryCalculator expiryRule = getExpiryRuleCalculator();
final LocalDate expiryDate = expiryRule.getExpiryMonth(futureOptionNumber.intValue(), surfaceDate);
final String expiryCode = BloombergFutureUtils.getShortExpiryCode(expiryDate);
ticker.append(expiryCode);
ticker.append(strike > useCallAboveStrike() ? "C" : "P");
ticker.append(" ");
// temp workaround for BZA which has 2 decimal places - need to find the proper rule.
//if (prefix.equals("BZA")) {
// ticker.append(withTwoDigits.format(strike));
//} else {
ticker.append(strike);
//}
ticker.append(" ");
ticker.append(getPostfix());
return ExternalId.of(getScheme(), ticker.toString());
} | ArgumentChecker.notNull(futureOptionNumber, STR); ArgumentChecker.notNull(strike, STR); ArgumentChecker.notNull(surfaceDate, STR); final String prefix = getFutureOptionPrefix(); final StringBuffer ticker = new StringBuffer(); ticker.append(prefix); final ExchangeTradedInstrumentExpiryCalculator expiryRule = getExpiryRuleCalculator(); final LocalDate expiryDate = expiryRule.getExpiryMonth(futureOptionNumber.intValue(), surfaceDate); final String expiryCode = BloombergFutureUtils.getShortExpiryCode(expiryDate); ticker.append(expiryCode); ticker.append(strike > useCallAboveStrike() ? "C" : "P"); ticker.append(" "); ticker.append(strike); ticker.append(" "); ticker.append(getPostfix()); return ExternalId.of(getScheme(), ticker.toString()); } | /**
* Provides an ExternalID for Bloomberg ticker,
* given a reference date and an integer offset, the n'th subsequent option <p>
* The format is prefix + expiry code + callPutFlag + strike + postfix <p>
* e.g. S U3P 45 Comdty
* <p>
* @param futureOptionNumber n'th future following curve date, not null
* @param strike option's strike, not null
* @param surfaceDate date of curve validity; valuation date, not null
* @return the id of the Bloomberg ticker
*/ | Provides an ExternalID for Bloomberg ticker, given a reference date and an integer offset, the n'th subsequent option The format is prefix + expiry code + callPutFlag + strike + postfix e.g. S U3P 45 Comdty | getInstrument | {
"repo_name": "DevStreet/FinanceAnalytics",
"path": "projects/OG-Financial/src/main/java/com/opengamma/financial/analytics/volatility/surface/BloombergCommodityFutureOptionVolatilitySurfaceInstrumentProvider.java",
"license": "apache-2.0",
"size": 5780
} | [
"com.opengamma.financial.convention.expirycalc.ExchangeTradedInstrumentExpiryCalculator",
"com.opengamma.id.ExternalId",
"com.opengamma.util.ArgumentChecker",
"org.threeten.bp.LocalDate"
] | import com.opengamma.financial.convention.expirycalc.ExchangeTradedInstrumentExpiryCalculator; import com.opengamma.id.ExternalId; import com.opengamma.util.ArgumentChecker; import org.threeten.bp.LocalDate; | import com.opengamma.financial.convention.expirycalc.*; import com.opengamma.id.*; import com.opengamma.util.*; import org.threeten.bp.*; | [
"com.opengamma.financial",
"com.opengamma.id",
"com.opengamma.util",
"org.threeten.bp"
] | com.opengamma.financial; com.opengamma.id; com.opengamma.util; org.threeten.bp; | 1,575,280 |
public void testNodeSerialize() throws Exception {
for (DiscoverySpi spi : spis) {
ClusterNode node = spi.getLocalNode();
assert node != null;
writeObject(node);
info("Serialize node success [nodeId=" + node.id() + ", spiIdx=" + spis.indexOf(spi) + ']');
}
} | void function() throws Exception { for (DiscoverySpi spi : spis) { ClusterNode node = spi.getLocalNode(); assert node != null; writeObject(node); info(STR + node.id() + STR + spis.indexOf(spi) + ']'); } } | /**
* Checks that node serializable.
*
* @throws Exception If failed.
*/ | Checks that node serializable | testNodeSerialize | {
"repo_name": "psadusumilli/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java",
"license": "apache-2.0",
"size": 17272
} | [
"org.apache.ignite.cluster.ClusterNode"
] | import org.apache.ignite.cluster.ClusterNode; | import org.apache.ignite.cluster.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 632,747 |
public void finishConnectAsPrimary(String verificationCode) throws IOException {
if(accountManager == null) {
throw new IllegalStateException("Cannot finish: No connection started!");
} else if(isRegistered()) {
throw new IllegalStateException("Already registered!");
}
createRegistrationId();
accountManager.verifyAccountWithCode(verificationCode, store.getSignalingKey(),
store.getLocalRegistrationId(), false, true);
IdentityKeyPair identityKeyPair = KeyHelper.generateIdentityKeyPair();
store.setIdentityKeyPair(identityKeyPair);
store.setLastResortPreKey(KeyHelper.generateLastResortPreKey());
checkPreKeys(-1);
save();
}
| void function(String verificationCode) throws IOException { if(accountManager == null) { throw new IllegalStateException(STR); } else if(isRegistered()) { throw new IllegalStateException(STR); } createRegistrationId(); accountManager.verifyAccountWithCode(verificationCode, store.getSignalingKey(), store.getLocalRegistrationId(), false, true); IdentityKeyPair identityKeyPair = KeyHelper.generateIdentityKeyPair(); store.setIdentityKeyPair(identityKeyPair); store.setLastResortPreKey(KeyHelper.generateLastResortPreKey()); checkPreKeys(-1); save(); } | /**
* Finish the connection and registration as primary device with the received verification code
* @param verificationCode the verification code without the -
* @throws IOException
*/ | Finish the connection and registration as primary device with the received verification code | finishConnectAsPrimary | {
"repo_name": "Turakar/signal4j",
"path": "src/main/java/de/thoffbauer/signal4j/SignalService.java",
"license": "gpl-3.0",
"size": 30493
} | [
"java.io.IOException",
"org.whispersystems.libsignal.IdentityKeyPair",
"org.whispersystems.libsignal.util.KeyHelper"
] | import java.io.IOException; import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.util.KeyHelper; | import java.io.*; import org.whispersystems.libsignal.*; import org.whispersystems.libsignal.util.*; | [
"java.io",
"org.whispersystems.libsignal"
] | java.io; org.whispersystems.libsignal; | 2,154,340 |
Session session = HibernateUtil.getSession();
Transaction tx = null;
WineryServer wineryServer = null;
try {
tx = session.beginTransaction();
wineryServer = (WineryServer) session.get(WineryServer.class, id);
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
tx.rollback();
}
throw new PersistenceException(e);
} finally {
session.close();
}
return wineryServer;
} | Session session = HibernateUtil.getSession(); Transaction tx = null; WineryServer wineryServer = null; try { tx = session.beginTransaction(); wineryServer = (WineryServer) session.get(WineryServer.class, id); tx.commit(); } catch (HibernateException e) { if (tx != null) { tx.rollback(); } throw new PersistenceException(e); } finally { session.close(); } return wineryServer; } | /**
* Returns a WineryServer for the given id.
*
* @param id
* @return WineryServer
* @throws PersistenceException
* upon problems committing the underlying transaction
*/ | Returns a WineryServer for the given id | getbyId | {
"repo_name": "CloudCycle2/CSAR_Repository",
"path": "src/main/java/org/opentosca/csarrepo/model/repository/WineryServerRepository.java",
"license": "apache-2.0",
"size": 3842
} | [
"org.hibernate.HibernateException",
"org.hibernate.Session",
"org.hibernate.Transaction",
"org.opentosca.csarrepo.exception.PersistenceException",
"org.opentosca.csarrepo.model.WineryServer"
] | import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.Transaction; import org.opentosca.csarrepo.exception.PersistenceException; import org.opentosca.csarrepo.model.WineryServer; | import org.hibernate.*; import org.opentosca.csarrepo.exception.*; import org.opentosca.csarrepo.model.*; | [
"org.hibernate",
"org.opentosca.csarrepo"
] | org.hibernate; org.opentosca.csarrepo; | 2,365,252 |
private JSONArray getJSONForHistogram(double min, double max, String field, boolean isLogarithmic, String whereClause, Queue<Map.Entry<String, FieldType>> searchValues) throws JSONException {
//Get min and max steps
double difference = max - min;
int digits = (int) Math.floor(Math.log10(difference));
//get histogram classes
long upperBound = new BigDecimal(max).setScale(-digits, BigDecimal.ROUND_CEILING).longValue();
long lowerBound = new BigDecimal(min).setScale(-digits, BigDecimal.ROUND_FLOOR).longValue();
double step = ((double) (upperBound-lowerBound))/((double)HISTOGRAMCLASSES);
System.out.println("lower: " + lowerBound + ", upper: " + upperBound + ", digits: " + digits + ", diff: " + difference + ", step: " + step);
//psql width_bucket: gets the histogram class in which a value belongs
final String sql =
"select "
+ " width_bucket(" + field + "," + lowerBound + "," + upperBound + "," + HISTOGRAMCLASSES + ") bucket, "
+ " count(*) cnt "
+ " from test t "
+ " LEFT JOIN network_type nt ON nt.uid=t.network_type"
+ " LEFT JOIN device_map adm ON adm.codename=t.model"
+ " LEFT JOIN test_server ts ON ts.uid=t.server_id"
+ " LEFT JOIN provider prov ON provider_id = prov.uid "
+ " LEFT JOIN provider mprov ON mobile_provider_id = mprov.uid"
+ " where " + field + " > 0 "
+ " AND t.deleted = false"
+ ((this.excludeImplausible) ? " AND implausible = false" : "")
+ " AND status = 'FINISHED' " + whereClause
+ " group by bucket " + "order by bucket asc;";
JSONArray jArray = new JSONArray();
try {
PreparedStatement stmt = conn.prepareStatement(sql);
stmt = fillInWhereClause(stmt, searchValues, 1);
ResultSet rs = stmt.executeQuery();
JSONObject jBucket = null;
long prevCnt = 0;
int prevBucket = 0;
while(rs.next()) {
int bucket = rs.getInt("bucket");
long cnt = rs.getLong("cnt");
double current_lower_bound = lowerBound + step * (bucket - 1);
//logarithmic -> times 10 for kbit
if (isLogarithmic)
current_lower_bound = Math.pow(10, current_lower_bound*4)*10;
double current_upper_bound = lowerBound + (step * bucket);
if (isLogarithmic)
current_upper_bound = Math.pow(10, current_upper_bound*4)*10;
if (bucket-prevBucket > 1) {
//problem: bucket without values
//solution: respond with classes with "0" elements in them
int diff = bucket-prevBucket;
for (int i=1;i<diff;i++) {
prevBucket++;
jBucket = new JSONObject();
double tLowerBound = lowerBound + step * (prevBucket - 1);
if (isLogarithmic)
tLowerBound = Math.pow(10, tLowerBound*4)*10;
double tUpperBound = lowerBound + (step * prevBucket);
if (isLogarithmic)
tUpperBound = Math.pow(10, tUpperBound*4)*10;
jBucket.put("lower_bound", tLowerBound);
jBucket.put("upper_bound", tUpperBound);
jBucket.put("results", 0);
jArray.put(jBucket);
}
}
prevBucket = bucket;
prevCnt = cnt;
jBucket = new JSONObject();
if (bucket == 0) {
jBucket.put("lower_bound", JSONObject.NULL);
} else {
//2 digits accuracy for small differences
if (step < 1 && !isLogarithmic)
jBucket.put("lower_bound", ((double) Math.round(current_lower_bound*100))/(double) 100);
else
jBucket.put("lower_bound", Math.round(current_lower_bound));
}
if (bucket == HISTOGRAMCLASSES + 1) {
jBucket.put("upper_bound", JSONObject.NULL);
} else {
if (step < 1 && !isLogarithmic)
jBucket.put("upper_bound", ((double) Math.round(current_upper_bound*100))/(double) 100);
else
jBucket.put("upper_bound", Math.round(current_upper_bound));
}
jBucket.put("results", cnt);
jArray.put(jBucket);
}
//problem: not enough buckets
//solution: respond with classes with "0" elements
if (jArray.length() < HISTOGRAMCLASSES) {
int diff = HISTOGRAMCLASSES - jArray.length();
int bucket = jArray.length();
for (int i=0;i<diff;i++) {
jBucket = new JSONObject();
bucket++;
double tLowerBound = lowerBound + step * (bucket - 1);
if (isLogarithmic)
tLowerBound = Math.pow(10, tLowerBound*4)*10;
double tUpperBound = lowerBound + (step * bucket);
if (isLogarithmic)
tUpperBound = Math.pow(10, tUpperBound*4)*10;
jBucket.put("lower_bound", tLowerBound);
jBucket.put("upper_bound", tUpperBound);
jBucket.put("results", 0);
jArray.put(jBucket);
}
}
rs.close();
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jArray;
} | JSONArray function(double min, double max, String field, boolean isLogarithmic, String whereClause, Queue<Map.Entry<String, FieldType>> searchValues) throws JSONException { double difference = max - min; int digits = (int) Math.floor(Math.log10(difference)); long upperBound = new BigDecimal(max).setScale(-digits, BigDecimal.ROUND_CEILING).longValue(); long lowerBound = new BigDecimal(min).setScale(-digits, BigDecimal.ROUND_FLOOR).longValue(); double step = ((double) (upperBound-lowerBound))/((double)HISTOGRAMCLASSES); System.out.println(STR + lowerBound + STR + upperBound + STR + digits + STR + difference + STR + step); final String sql = STR + STR + field + "," + lowerBound + "," + upperBound + "," + HISTOGRAMCLASSES + STR + STR + STR + STR + STR + STR + STR + STR + STR + field + STR + STR + ((this.excludeImplausible) ? STR : STR AND status = 'FINISHED' STR group by bucket STRorder by bucket asc;STRbucketSTRcntSTRlower_boundSTRupper_boundSTRresultsSTRlower_boundSTRlower_boundSTRlower_boundSTRupper_boundSTRupper_boundSTRupper_boundSTRresultsSTRlower_boundSTRupper_boundSTRresults", 0); jArray.put(jBucket); } } rs.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return jArray; } | /**
* Gets the JSON Array for a specific histogram
* @param min lower bound of first class
* @param max upper bound of last class
* @param field numeric database-field that the histogram is based on
* @param isLogarithmic
* @param whereClause
* @param searchValues
* @return
* @throws JSONException
* @throws CacheException
*/ | Gets the JSON Array for a specific histogram | getJSONForHistogram | {
"repo_name": "alladin-IT/open-rmbt",
"path": "RMBTStatisticServer/src/at/alladin/rmbt/statisticServer/OpenTestSearchResource.java",
"license": "apache-2.0",
"size": 41283
} | [
"java.math.BigDecimal",
"java.sql.SQLException",
"java.util.Map",
"java.util.Queue",
"org.json.JSONArray",
"org.json.JSONException"
] | import java.math.BigDecimal; import java.sql.SQLException; import java.util.Map; import java.util.Queue; import org.json.JSONArray; import org.json.JSONException; | import java.math.*; import java.sql.*; import java.util.*; import org.json.*; | [
"java.math",
"java.sql",
"java.util",
"org.json"
] | java.math; java.sql; java.util; org.json; | 2,827,654 |
void endTablePart(boolean lastInBody, boolean lastOnPage) {
addAreasAndFlushRow(lastInBody, lastOnPage);
if (tablePartBackground != null) {
TableLayoutManager tableLM = tclm.getTableLM();
for (Iterator iter = tablePartBackgroundAreas.iterator(); iter.hasNext();) {
Block backgroundArea = (Block) iter.next();
TraitSetter.addBackground(backgroundArea, tablePartBackground, tableLM,
-backgroundArea.getXOffset(), tablePartOffset - backgroundArea.getYOffset(),
tableLM.getContentAreaIPD(), currentRowOffset - tablePartOffset);
}
tablePartBackground = null;
tablePartBackgroundAreas.clear();
}
} | void endTablePart(boolean lastInBody, boolean lastOnPage) { addAreasAndFlushRow(lastInBody, lastOnPage); if (tablePartBackground != null) { TableLayoutManager tableLM = tclm.getTableLM(); for (Iterator iter = tablePartBackgroundAreas.iterator(); iter.hasNext();) { Block backgroundArea = (Block) iter.next(); TraitSetter.addBackground(backgroundArea, tablePartBackground, tableLM, -backgroundArea.getXOffset(), tablePartOffset - backgroundArea.getYOffset(), tableLM.getContentAreaIPD(), currentRowOffset - tablePartOffset); } tablePartBackground = null; tablePartBackgroundAreas.clear(); } } | /**
* Signals that the end of the current table part is reached.
*
* @param lastInBody true if the part is the last table-body element to be displayed
* on the current page. In which case all the cells must be flushed even if they
* aren't finished, plus the proper collapsed borders must be selected (trailing
* instead of normal, or rest if the cell is unfinished)
* @param lastOnPage true if the part is the last to be displayed on the current page.
* In which case collapsed after borders for the cells on the last row must be drawn
* in the outer mode
*/ | Signals that the end of the current table part is reached | endTablePart | {
"repo_name": "spepping/fop-cs",
"path": "src/java/org/apache/fop/layoutmgr/table/RowPainter.java",
"license": "apache-2.0",
"size": 24560
} | [
"java.util.Iterator",
"org.apache.fop.area.Block",
"org.apache.fop.layoutmgr.TraitSetter"
] | import java.util.Iterator; import org.apache.fop.area.Block; import org.apache.fop.layoutmgr.TraitSetter; | import java.util.*; import org.apache.fop.area.*; import org.apache.fop.layoutmgr.*; | [
"java.util",
"org.apache.fop"
] | java.util; org.apache.fop; | 260,143 |
public void setDepositedCashieringChecksTotal(KualiDecimal depositedCashieringChecksTotal) {
this.depositedCashieringChecksTotal = depositedCashieringChecksTotal;
} | void function(KualiDecimal depositedCashieringChecksTotal) { this.depositedCashieringChecksTotal = depositedCashieringChecksTotal; } | /**
* Sets the depositedCashieringChecksTotal attribute value.
*
* @param depositedCashieringChecksTotal The depositedCashieringChecksTotal to set.
*/ | Sets the depositedCashieringChecksTotal attribute value | setDepositedCashieringChecksTotal | {
"repo_name": "bhutchinson/kfs",
"path": "kfs-core/src/main/java/org/kuali/kfs/fp/document/web/struts/CashManagementForm.java",
"license": "agpl-3.0",
"size": 42584
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,393,922 |
public BrowsingContext getBrowsingContext() {
return _document.getBrowsingContext();
}
| BrowsingContext function() { return _document.getBrowsingContext(); } | /**
* Returns associated browsing context.
*
* @return Associated browsing context.
*/ | Returns associated browsing context | getBrowsingContext | {
"repo_name": "ITman1/ScriptBox",
"path": "src/main/java/org/fit/cssbox/scriptbox/events/Task.java",
"license": "gpl-2.0",
"size": 5323
} | [
"org.fit.cssbox.scriptbox.browser.BrowsingContext"
] | import org.fit.cssbox.scriptbox.browser.BrowsingContext; | import org.fit.cssbox.scriptbox.browser.*; | [
"org.fit.cssbox"
] | org.fit.cssbox; | 23,208 |
public ActionForward execute(ActionMapping mapping_, ActionForm form_,
HttpServletRequest request_, HttpServletResponse response_)
{
// Create the bean for all our processing and present the Alert List.
LogonForm form = (LogonForm) form_;
createBean(request_, form.getUserid(), form.getUserName(), form.getPswd());
return mapping_.findForward(Constants._ACTLIST);
} | ActionForward function(ActionMapping mapping_, ActionForm form_, HttpServletRequest request_, HttpServletResponse response_) { LogonForm form = (LogonForm) form_; createBean(request_, form.getUserid(), form.getUserName(), form.getPswd()); return mapping_.findForward(Constants._ACTLIST); } | /**
* Action process for the user Login.
*
* @param mapping_
* The action map defined in struts-config.xml.
* @param form_
* The form bean for this jsp.
* @param request_
* The servlet request object.
* @param response_
* The servlet response object.
* @return The action to forward to continue processing.
*/ | Action process for the user Login | execute | {
"repo_name": "NCIP/cadsr-sentinel",
"path": "software/src/java/gov/nih/nci/cadsr/sentinel/ui/Logon.java",
"license": "bsd-3-clause",
"size": 2420
} | [
"gov.nih.nci.cadsr.sentinel.tool.Constants",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping"
] | import gov.nih.nci.cadsr.sentinel.tool.Constants; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; | import gov.nih.nci.cadsr.sentinel.tool.*; import javax.servlet.http.*; import org.apache.struts.action.*; | [
"gov.nih.nci",
"javax.servlet",
"org.apache.struts"
] | gov.nih.nci; javax.servlet; org.apache.struts; | 1,718,994 |
public static double sumF(DTMAxisIterator iterator, DOM dom) {
try {
double result = 0.0;
int node;
while ((node = iterator.next()) != DTMAxisIterator.END) {
result += Double.parseDouble(dom.getStringValueX(node));
}
return result;
}
catch (NumberFormatException e) {
return Double.NaN;
}
} | static double function(DTMAxisIterator iterator, DOM dom) { try { double result = 0.0; int node; while ((node = iterator.next()) != DTMAxisIterator.END) { result += Double.parseDouble(dom.getStringValueX(node)); } return result; } catch (NumberFormatException e) { return Double.NaN; } } | /**
* XSLT Standard function sum(node-set).
* stringToDouble is inlined
*/ | XSLT Standard function sum(node-set). stringToDouble is inlined | sumF | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java",
"license": "gpl-2.0",
"size": 60809
} | [
"com.sun.org.apache.xml.internal.dtm.DTMAxisIterator"
] | import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator; | import com.sun.org.apache.xml.internal.dtm.*; | [
"com.sun.org"
] | com.sun.org; | 1,343,273 |
public void setCustomToken(Element customToken) {
this.customToken = customToken;
} | void function(Element customToken) { this.customToken = customToken; } | /**
* Set the custom token
* @param customToken
*/ | Set the custom token | setCustomToken | {
"repo_name": "asoldano/wss4j",
"path": "ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSPasswordCallback.java",
"license": "apache-2.0",
"size": 10018
} | [
"org.w3c.dom.Element"
] | import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 737,044 |
EReference getActivity_Default(); | EReference getActivity_Default(); | /**
* Returns the meta object for the reference '{@link org.eclipse.bpmn2.Activity#getDefault <em>Default</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Default</em>'.
* @see org.eclipse.bpmn2.Activity#getDefault()
* @see #getActivity()
* @generated
*/ | Returns the meta object for the reference '<code>org.eclipse.bpmn2.Activity#getDefault Default</code>'. | getActivity_Default | {
"repo_name": "lqjack/fixflow",
"path": "modules/fixflow-core/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java",
"license": "apache-2.0",
"size": 1014933
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,407,938 |
void scheduleImmediateIndexing(MutableStatusHolder statusHolder); | void scheduleImmediateIndexing(MutableStatusHolder statusHolder); | /**
* Schedule the indexer to run immediately even if it is disabled
*/ | Schedule the indexer to run immediately even if it is disabled | scheduleImmediateIndexing | {
"repo_name": "alancnet/artifactory",
"path": "base/api/src/main/java/org/artifactory/api/repo/index/MavenIndexerService.java",
"license": "apache-2.0",
"size": 1596
} | [
"org.artifactory.common.MutableStatusHolder"
] | import org.artifactory.common.MutableStatusHolder; | import org.artifactory.common.*; | [
"org.artifactory.common"
] | org.artifactory.common; | 1,586,091 |
public static final Object readValueXml(XmlPullParser parser, String[] name)
throws XmlPullParserException, IOException
{
int eventType = parser.getEventType();
do {
if (eventType == parser.START_TAG) {
return readThisValueXml(parser, name, null, false);
} else if (eventType == parser.END_TAG) {
throw new XmlPullParserException(
"Unexpected end tag at: " + parser.getName());
} else if (eventType == parser.TEXT) {
throw new XmlPullParserException(
"Unexpected text: " + parser.getText());
}
eventType = parser.next();
} while (eventType != parser.END_DOCUMENT);
throw new XmlPullParserException(
"Unexpected end of document");
} | static final Object function(XmlPullParser parser, String[] name) throws XmlPullParserException, IOException { int eventType = parser.getEventType(); do { if (eventType == parser.START_TAG) { return readThisValueXml(parser, name, null, false); } else if (eventType == parser.END_TAG) { throw new XmlPullParserException( STR + parser.getName()); } else if (eventType == parser.TEXT) { throw new XmlPullParserException( STR + parser.getText()); } eventType = parser.next(); } while (eventType != parser.END_DOCUMENT); throw new XmlPullParserException( STR); } | /**
* Read a flattened object from an XmlPullParser. The XML data could
* previously have been written with writeMapXml(), writeListXml(), or
* writeValueXml(). The XmlPullParser must be positioned <em>at</em> the
* tag that defines the value.
*
* @param parser The XmlPullParser from which to read the object.
* @param name An array of one string, used to return the name attribute
* of the value's tag.
*
* @return Object The newly generated value object.
*
* @see #readMapXml
* @see #readListXml
* @see #writeValueXml
*/ | Read a flattened object from an XmlPullParser. The XML data could previously have been written with writeMapXml(), writeListXml(), or writeValueXml(). The XmlPullParser must be positioned at the tag that defines the value | readValueXml | {
"repo_name": "wiki2014/Learning-Summary",
"path": "alps/cts/tests/tests/content/src/android/content/cts/util/XmlUtils.java",
"license": "gpl-3.0",
"size": 62083
} | [
"java.io.IOException",
"org.xmlpull.v1.XmlPullParser",
"org.xmlpull.v1.XmlPullParserException"
] | import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; | import java.io.*; import org.xmlpull.v1.*; | [
"java.io",
"org.xmlpull.v1"
] | java.io; org.xmlpull.v1; | 12,926 |
super.doPreSetup();
try {
xmppServer.stopXmppEndpoint();
} catch (IOException e) {
LOG.warn("Failed to stop XMPP endpoint: {}", e.getMessage(), e);
}
} | super.doPreSetup(); try { xmppServer.stopXmppEndpoint(); } catch (IOException e) { LOG.warn(STR, e.getMessage(), e); } } | /**
* Ensures that the XMPP server instance is created and 'stopped' before the camel routes are initialized
*/ | Ensures that the XMPP server instance is created and 'stopped' before the camel routes are initialized | doPreSetup | {
"repo_name": "nicolaferraro/camel",
"path": "components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/XmppDeferredConnectionTest.java",
"license": "apache-2.0",
"size": 4506
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,408,107 |
public Vertex createName(String text, Vertex meaning, Network network) {
Vertex word = createWord(text, meaning, network, Primitive.NOUN);
word.addRelationship(Primitive.INSTANTIATION, Primitive.NAME);
return word;
} | Vertex function(String text, Vertex meaning, Network network) { Vertex word = createWord(text, meaning, network, Primitive.NOUN); word.addRelationship(Primitive.INSTANTIATION, Primitive.NAME); return word; } | /**
* Create the name with the meaning.
*/ | Create the name with the meaning | createName | {
"repo_name": "BOTlibre/BOTlibre",
"path": "micro-ai-engine/android/source/org/botlibre/knowledge/Bootstrap.java",
"license": "epl-1.0",
"size": 53137
} | [
"org.botlibre.api.knowledge.Network",
"org.botlibre.api.knowledge.Vertex"
] | import org.botlibre.api.knowledge.Network; import org.botlibre.api.knowledge.Vertex; | import org.botlibre.api.knowledge.*; | [
"org.botlibre.api"
] | org.botlibre.api; | 1,603,877 |
public Map<String, Attribute> getAttributes() {
return this.attributes;
} | Map<String, Attribute> function() { return this.attributes; } | /**
* Gets the attributes.
*
* @return the attributes
*/ | Gets the attributes | getAttributes | {
"repo_name": "mapfish/mapfish-print",
"path": "core/src/main/java/org/mapfish/print/attribute/DataSourceAttribute.java",
"license": "bsd-2-clause",
"size": 7849
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 650,166 |
public static double getInputCurrent() {
return PowerJNI.getVinCurrent();
} | static double function() { return PowerJNI.getVinCurrent(); } | /**
* Get the input current to the robot controller.
*
* @return The controller input current value in Amps
*/ | Get the input current to the robot controller | getInputCurrent | {
"repo_name": "pjreiniger/TempAllWpi",
"path": "wpilibj/src/main/java/edu/wpi/first/wpilibj/ControllerPower.java",
"license": "bsd-3-clause",
"size": 3913
} | [
"edu.wpi.first.wpilibj.hal.PowerJNI"
] | import edu.wpi.first.wpilibj.hal.PowerJNI; | import edu.wpi.first.wpilibj.hal.*; | [
"edu.wpi.first"
] | edu.wpi.first; | 1,515,036 |
public void onAddTypeOfPlantsAction() throws IOException
{
FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fr/loicdelorme/followUpYourGarden/views/TypeOfPlantsForm.fxml"));
Stage stage = new Stage();
stage.setScene(new Scene(loader.load()));
TypeOfPlantsFormController controller = loader.getController();
controller.initializeData(null, this.followUpYourGardenServices.getTypeOfPlantsServices(), stage, this.bundle);
stage.showAndWait();
}
| void function() throws IOException { FXMLLoader loader = new FXMLLoader(this.getClass().getResource(STR)); Stage stage = new Stage(); stage.setScene(new Scene(loader.load())); TypeOfPlantsFormController controller = loader.getController(); controller.initializeData(null, this.followUpYourGardenServices.getTypeOfPlantsServices(), stage, this.bundle); stage.showAndWait(); } | /**
* The on click add type of plants action.
*
* @throws IOException
* If the file can't be opened.
*/ | The on click add type of plants action | onAddTypeOfPlantsAction | {
"repo_name": "LoicDelorme/Follow-Up-Your-Garden",
"path": "src/fr/loicdelorme/followUpYourGarden/controllers/TasksToBeCarryOutScheduleController.java",
"license": "mit",
"size": 21804
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,637,048 |
public static Date getEndDateOfMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getMaximum(Calendar.DAY_OF_MONTH));
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTime();
} | static Date function(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_MONTH, calendar.getMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar.getTime(); } | /**
* Compute the date of the last day in the month of the specified date.
* @param date the specified date.
* @return a date for the last day of the month of the specified date.
*/ | Compute the date of the last day in the month of the specified date | getEndDateOfMonth | {
"repo_name": "NicolasEYSSERIC/Silverpeas-Core",
"path": "lib-core/src/main/java/com/stratelia/webactiv/util/DateUtil.java",
"license": "agpl-3.0",
"size": 25701
} | [
"java.util.Calendar",
"java.util.Date"
] | import java.util.Calendar; import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 711,189 |
public void setComparator(TypeComparatorFactory<?> comparator, int id) {
this.comparators[id] = comparator;
}
// --------------------------------------------------------------------------------------------
| void function(TypeComparatorFactory<?> comparator, int id) { this.comparators[id] = comparator; } | /**
* Sets the specified comparator for this PlanNode.
*
* @param comparator The comparator to set.
* @param id The ID of the comparator to set.
*/ | Sets the specified comparator for this PlanNode | setComparator | {
"repo_name": "jinglining/flink",
"path": "flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/SingleInputPlanNode.java",
"license": "apache-2.0",
"size": 8434
} | [
"org.apache.flink.api.common.typeutils.TypeComparatorFactory"
] | import org.apache.flink.api.common.typeutils.TypeComparatorFactory; | import org.apache.flink.api.common.typeutils.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,791,551 |
private ConsumerRecord<K, V> parseRecord(TopicPartition partition, LogEntry logEntry) {
Record record = logEntry.record();
if (this.checkCrcs) {
try {
record.ensureValid();
} catch (InvalidRecordException e) {
throw new KafkaException("Record for partition " + partition + " at offset " + logEntry.offset()
+ " is invalid, cause: " + e.getMessage());
}
}
try {
long offset = logEntry.offset();
long timestamp = record.timestamp();
TimestampType timestampType = record.timestampType();
ByteBuffer keyBytes = record.key();
byte[] keyByteArray = keyBytes == null ? null : Utils.toArray(keyBytes);
K key = keyBytes == null ? null : this.keyDeserializer.deserialize(partition.topic(), keyByteArray);
ByteBuffer valueBytes = record.value();
byte[] valueByteArray = valueBytes == null ? null : Utils.toArray(valueBytes);
V value = valueBytes == null ? null : this.valueDeserializer.deserialize(partition.topic(), valueByteArray);
return new ConsumerRecord<>(partition.topic(), partition.partition(), offset,
timestamp, timestampType, record.checksum(),
keyByteArray == null ? ConsumerRecord.NULL_SIZE : keyByteArray.length,
valueByteArray == null ? ConsumerRecord.NULL_SIZE : valueByteArray.length,
key, value);
} catch (RuntimeException e) {
throw new SerializationException("Error deserializing key/value for partition " + partition +
" at offset " + logEntry.offset(), e);
}
}
private static class PartitionRecords<K, V> {
private long fetchOffset;
private TopicPartition partition;
private List<ConsumerRecord<K, V>> records;
public PartitionRecords(long fetchOffset, TopicPartition partition, List<ConsumerRecord<K, V>> records) {
this.fetchOffset = fetchOffset;
this.partition = partition;
this.records = records;
} | ConsumerRecord<K, V> function(TopicPartition partition, LogEntry logEntry) { Record record = logEntry.record(); if (this.checkCrcs) { try { record.ensureValid(); } catch (InvalidRecordException e) { throw new KafkaException(STR + partition + STR + logEntry.offset() + STR + e.getMessage()); } } try { long offset = logEntry.offset(); long timestamp = record.timestamp(); TimestampType timestampType = record.timestampType(); ByteBuffer keyBytes = record.key(); byte[] keyByteArray = keyBytes == null ? null : Utils.toArray(keyBytes); K key = keyBytes == null ? null : this.keyDeserializer.deserialize(partition.topic(), keyByteArray); ByteBuffer valueBytes = record.value(); byte[] valueByteArray = valueBytes == null ? null : Utils.toArray(valueBytes); V value = valueBytes == null ? null : this.valueDeserializer.deserialize(partition.topic(), valueByteArray); return new ConsumerRecord<>(partition.topic(), partition.partition(), offset, timestamp, timestampType, record.checksum(), keyByteArray == null ? ConsumerRecord.NULL_SIZE : keyByteArray.length, valueByteArray == null ? ConsumerRecord.NULL_SIZE : valueByteArray.length, key, value); } catch (RuntimeException e) { throw new SerializationException(STR + partition + STR + logEntry.offset(), e); } } private static class PartitionRecords<K, V> { private long fetchOffset; private TopicPartition partition; private List<ConsumerRecord<K, V>> records; public PartitionRecords(long fetchOffset, TopicPartition partition, List<ConsumerRecord<K, V>> records) { this.fetchOffset = fetchOffset; this.partition = partition; this.records = records; } | /**
* Parse the record entry, deserializing the key / value fields if necessary
*/ | Parse the record entry, deserializing the key / value fields if necessary | parseRecord | {
"repo_name": "geeag/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java",
"license": "apache-2.0",
"size": 47756
} | [
"java.nio.ByteBuffer",
"java.util.List",
"org.apache.kafka.clients.consumer.ConsumerRecord",
"org.apache.kafka.common.KafkaException",
"org.apache.kafka.common.TopicPartition",
"org.apache.kafka.common.errors.SerializationException",
"org.apache.kafka.common.record.InvalidRecordException",
"org.apache... | import java.nio.ByteBuffer; import java.util.List; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.errors.SerializationException; import org.apache.kafka.common.record.InvalidRecordException; import org.apache.kafka.common.record.LogEntry; import org.apache.kafka.common.record.Record; import org.apache.kafka.common.record.TimestampType; import org.apache.kafka.common.utils.Utils; | import java.nio.*; import java.util.*; import org.apache.kafka.clients.consumer.*; import org.apache.kafka.common.*; import org.apache.kafka.common.errors.*; import org.apache.kafka.common.record.*; import org.apache.kafka.common.utils.*; | [
"java.nio",
"java.util",
"org.apache.kafka"
] | java.nio; java.util; org.apache.kafka; | 1,648,587 |
void moveToVisualPosition(@Nonnull VisualPosition pos); | void moveToVisualPosition(@Nonnull VisualPosition pos); | /**
* Moves the caret to the specified visual position.
*
* @param pos the position to move to.
*/ | Moves the caret to the specified visual position | moveToVisualPosition | {
"repo_name": "consulo/consulo",
"path": "modules/base/editor-ui-api/src/main/java/com/intellij/openapi/editor/Caret.java",
"license": "apache-2.0",
"size": 14019
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,349,865 |
public void renameSnapshot(String snapshotDir, String snapshotOldName,
String snapshotNewName) throws IOException {
checkOpen();
try (TraceScope ignored = tracer.newScope("renameSnapshot")) {
namenode.renameSnapshot(snapshotDir, snapshotOldName, snapshotNewName);
} catch (RemoteException re) {
throw re.unwrapRemoteException();
}
} | void function(String snapshotDir, String snapshotOldName, String snapshotNewName) throws IOException { checkOpen(); try (TraceScope ignored = tracer.newScope(STR)) { namenode.renameSnapshot(snapshotDir, snapshotOldName, snapshotNewName); } catch (RemoteException re) { throw re.unwrapRemoteException(); } } | /**
* Rename a snapshot.
* @param snapshotDir The directory path where the snapshot was taken
* @param snapshotOldName Old name of the snapshot
* @param snapshotNewName New name of the snapshot
* @throws IOException
* @see ClientProtocol#renameSnapshot(String, String, String)
*/ | Rename a snapshot | renameSnapshot | {
"repo_name": "aliyun-beta/aliyun-oss-hadoop-fs",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java",
"license": "apache-2.0",
"size": 108503
} | [
"java.io.IOException",
"org.apache.hadoop.ipc.RemoteException",
"org.apache.htrace.core.TraceScope"
] | import java.io.IOException; import org.apache.hadoop.ipc.RemoteException; import org.apache.htrace.core.TraceScope; | import java.io.*; import org.apache.hadoop.ipc.*; import org.apache.htrace.core.*; | [
"java.io",
"org.apache.hadoop",
"org.apache.htrace"
] | java.io; org.apache.hadoop; org.apache.htrace; | 1,820,711 |
public int compare(Publication publication1, Publication publication2) {
int EQUAL = 0;
int BEFORE = -1;
int AFTER = 1;
if (publication1 == publication2){
return EQUAL;
}
else if (publication1 == null){
return AFTER;
}
else if (publication2 == null){
return BEFORE;
}
else {
int comp = publicationComparator.compare(publication1, publication2);
if (comp != 0){
return comp;
}
// compares curation depth
CurationDepth depth1 = publication1.getCurationDepth();
CurationDepth depth2 = publication2.getCurationDepth();
int comp2 = depth1.compareTo(depth2);
if (comp2 != 0){
return comp2;
}
// compares sources
Source source1 = publication1.getSource();
Source source2 = publication2.getSource();
comp2 = sourceComparator.compare(source1, source2);
if (comp2 != 0){
return comp2;
}
// compares release dates
Date date1 = publication1.getReleasedDate();
Date date2 = publication2.getReleasedDate();
if (date1 == null && date2 == null){
return EQUAL;
}
else if (date1 == null){
return AFTER;
}
else if (date2 == null){
return BEFORE;
}
else if (date1.before(date2)){
return BEFORE;
}
else if (date2.before(date1)){
return AFTER;
}
else {
return EQUAL;
}
}
} | int function(Publication publication1, Publication publication2) { int EQUAL = 0; int BEFORE = -1; int AFTER = 1; if (publication1 == publication2){ return EQUAL; } else if (publication1 == null){ return AFTER; } else if (publication2 == null){ return BEFORE; } else { int comp = publicationComparator.compare(publication1, publication2); if (comp != 0){ return comp; } CurationDepth depth1 = publication1.getCurationDepth(); CurationDepth depth2 = publication2.getCurationDepth(); int comp2 = depth1.compareTo(depth2); if (comp2 != 0){ return comp2; } Source source1 = publication1.getSource(); Source source2 = publication2.getSource(); comp2 = sourceComparator.compare(source1, source2); if (comp2 != 0){ return comp2; } Date date1 = publication1.getReleasedDate(); Date date2 = publication2.getReleasedDate(); if (date1 == null && date2 == null){ return EQUAL; } else if (date1 == null){ return AFTER; } else if (date2 == null){ return BEFORE; } else if (date1.before(date2)){ return BEFORE; } else if (date2.before(date1)){ return AFTER; } else { return EQUAL; } } } | /**
* It uses a AbstractPublicationComparator to compares the bibliographic details and then will compare first the curation depth, then the source and then the released date.
*
* @param publication1 a {@link psidev.psi.mi.jami.model.Publication} object.
* @param publication2 a {@link psidev.psi.mi.jami.model.Publication} object.
* @return a int.
*/ | It uses a AbstractPublicationComparator to compares the bibliographic details and then will compare first the curation depth, then the source and then the released date | compare | {
"repo_name": "MICommunity/psi-jami",
"path": "jami-core/src/main/java/psidev/psi/mi/jami/utils/comparator/publication/CuratedPublicationComparator.java",
"license": "apache-2.0",
"size": 4334
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,319,203 |
@Test
void testInitNegotiateSecurityFilterProvider() throws ServletException {
final SimpleFilterConfig filterConfig = new SimpleFilterConfig();
filterConfig.setParameter("securityFilterProviders", "waffle.servlet.spi.NegotiateSecurityFilterProvider");
filterConfig.setParameter("waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols",
"NTLM\nNegotiate NTLM");
this.filter.init(filterConfig);
Assertions.assertEquals(this.filter.getPrincipalFormat(), PrincipalFormat.FQN);
Assertions.assertEquals(this.filter.getRoleFormat(), PrincipalFormat.FQN);
Assertions.assertTrue(this.filter.isAllowGuestLogin());
Assertions.assertEquals(1, this.filter.getProviders().size());
} | void testInitNegotiateSecurityFilterProvider() throws ServletException { final SimpleFilterConfig filterConfig = new SimpleFilterConfig(); filterConfig.setParameter(STR, STR); filterConfig.setParameter(STR, STR); this.filter.init(filterConfig); Assertions.assertEquals(this.filter.getPrincipalFormat(), PrincipalFormat.FQN); Assertions.assertEquals(this.filter.getRoleFormat(), PrincipalFormat.FQN); Assertions.assertTrue(this.filter.isAllowGuestLogin()); Assertions.assertEquals(1, this.filter.getProviders().size()); } | /**
* Test init negotiate security filter provider.
*
* @throws ServletException
* the servlet exception
*/ | Test init negotiate security filter provider | testInitNegotiateSecurityFilterProvider | {
"repo_name": "hazendaz/waffle",
"path": "Source/JNA/waffle-tests/src/test/java/waffle/servlet/NegotiateSecurityFilterTest.java",
"license": "mit",
"size": 19878
} | [
"javax.servlet.ServletException",
"org.junit.jupiter.api.Assertions"
] | import javax.servlet.ServletException; import org.junit.jupiter.api.Assertions; | import javax.servlet.*; import org.junit.jupiter.api.*; | [
"javax.servlet",
"org.junit.jupiter"
] | javax.servlet; org.junit.jupiter; | 801,360 |
@SafeHtmlTemplates.Template("<div name=\"{0}\" style=\"{1}\"><a href=\"javascript:;\">{2}</a></div>")
SafeHtml cell(String name, SafeStyles styles, String value);
}
private static Templates templates = GWT.create(Templates.class);
public TagListCell() {
super("click", "keydown");
} | @SafeHtmlTemplates.Template(STR{0}\STR{1}\STRjavascript:;\STR) SafeHtml cell(String name, SafeStyles styles, String value); } private static Templates templates = GWT.create(Templates.class); public TagListCell() { super("click", STR); } | /**
* The template for this Cell, which includes styles and a value.
*
* @param styles the styles to include in the style attribute of the div
* @param value the safe value. Since the value type is {@link SafeHtml}, it will
* not be escaped before including it in the template. Alternatively, you
* could make the value type String, in which case the value would be
* escaped.
* @return a {@link SafeHtml} instance
*/ | The template for this Cell, which includes styles and a value | cell | {
"repo_name": "justinhrobbins/FlashCards_App",
"path": "FlashCards_UI/FlashCards_GWT/src/main/java/org/robbins/flashcards/client/ui/widgets/TagListCell.java",
"license": "apache-2.0",
"size": 4791
} | [
"com.google.gwt.core.client.GWT",
"com.google.gwt.safecss.shared.SafeStyles",
"com.google.gwt.safehtml.client.SafeHtmlTemplates",
"com.google.gwt.safehtml.shared.SafeHtml"
] | import com.google.gwt.core.client.GWT; import com.google.gwt.safecss.shared.SafeStyles; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; | import com.google.gwt.core.client.*; import com.google.gwt.safecss.shared.*; import com.google.gwt.safehtml.client.*; import com.google.gwt.safehtml.shared.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,123,095 |
public BigDecimal getPlannedAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PlannedAmt);
if (bd == null)
return Env.ZERO;
return bd;
} | BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PlannedAmt); if (bd == null) return Env.ZERO; return bd; } | /** Get Planned Amount.
@return Planned amount for this project
*/ | Get Planned Amount | getPlannedAmt | {
"repo_name": "pplatek/adempiere",
"path": "base/src/org/compiere/model/X_C_ProjectLine.java",
"license": "gpl-2.0",
"size": 15521
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 36,752 |
protected void openConnection() {
try {
if (settings.isListenConnectorKind()) {
logWriter.println("Accepting JDWP connection");
transport.accept(settings.getTimeout(), settings.getTimeout());
} else {
String address = settings.getTransportAddress();
logWriter.println("Attaching for JDWP connection");
transport.attach(address, settings.getTimeout(), settings.getTimeout());
}
setConnection(transport);
} catch (IOException e) {
logWriter.printError(e);
throw new TestErrorException(e);
}
}
| void function() { try { if (settings.isListenConnectorKind()) { logWriter.println(STR); transport.accept(settings.getTimeout(), settings.getTimeout()); } else { String address = settings.getTransportAddress(); logWriter.println(STR); transport.attach(address, settings.getTimeout(), settings.getTimeout()); } setConnection(transport); } catch (IOException e) { logWriter.printError(e); throw new TestErrorException(e); } } | /**
* Opens connection with debuggee.
*/ | Opens connection with debuggee | openConnection | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/jdktools/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/share/JDWPUnitDebuggeeWrapper.java",
"license": "gpl-2.0",
"size": 5640
} | [
"java.io.IOException",
"org.apache.harmony.jpda.tests.framework.TestErrorException"
] | import java.io.IOException; import org.apache.harmony.jpda.tests.framework.TestErrorException; | import java.io.*; import org.apache.harmony.jpda.tests.framework.*; | [
"java.io",
"org.apache.harmony"
] | java.io; org.apache.harmony; | 848,682 |
public ResourceNameAvailabilityInner checkNameAvailability(String name, CheckNameResourceTypes type, Boolean isFqdn) {
return checkNameAvailabilityWithServiceResponseAsync(name, type, isFqdn).toBlocking().single().body();
} | ResourceNameAvailabilityInner function(String name, CheckNameResourceTypes type, Boolean isFqdn) { return checkNameAvailabilityWithServiceResponseAsync(name, type, isFqdn).toBlocking().single().body(); } | /**
* Check if a resource name is available.
* Check if a resource name is available.
*
* @param name Resource name to verify.
* @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers'
* @param isFqdn Is fully qualified domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws DefaultErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceNameAvailabilityInner object if successful.
*/ | Check if a resource name is available. Check if a resource name is available | checkNameAvailability | {
"repo_name": "hovsepm/azure-sdk-for-java",
"path": "appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java",
"license": "mit",
"size": 161895
} | [
"com.microsoft.azure.management.appservice.v2018_02_01.CheckNameResourceTypes"
] | import com.microsoft.azure.management.appservice.v2018_02_01.CheckNameResourceTypes; | import com.microsoft.azure.management.appservice.v2018_02_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 937,471 |
public byte lookup(Segment text, int offset, int length)
{
if(length == 0)
return Token.NULL;
Keyword k = map[getSegmentMapKey(text, offset, length)];
while(k != null)
{
if(length != k.keyword.length)
{
k = k.next;
continue;
}
if(SyntaxUtilities.regionMatches(ignoreCase,text,offset,
k.keyword))
return k.id;
k = k.next;
}
return Token.NULL;
} | byte function(Segment text, int offset, int length) { if(length == 0) return Token.NULL; Keyword k = map[getSegmentMapKey(text, offset, length)]; while(k != null) { if(length != k.keyword.length) { k = k.next; continue; } if(SyntaxUtilities.regionMatches(ignoreCase,text,offset, k.keyword)) return k.id; k = k.next; } return Token.NULL; } | /**
* Looks up a key.
* @param text The text segment
* @param offset The offset of the substring within the text segment
* @param length The length of the substring
*/ | Looks up a key | lookup | {
"repo_name": "NCIP/cagrid",
"path": "cagrid/Software/core/caGrid/projects/introduce/src/java/Portal/gov/nih/nci/cagrid/introduce/portal/common/jedit/KeywordMap.java",
"license": "bsd-3-clause",
"size": 3384
} | [
"javax.swing.text.Segment"
] | import javax.swing.text.Segment; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 1,655,519 |
public static Logger createLogger(Class clazz) {
return Logger.getInstance(clazz.getName());
}
| static Logger function(Class clazz) { return Logger.getInstance(clazz.getName()); } | /**
* Creates or returns the instance of a Logger for the given class.
*/ | Creates or returns the instance of a Logger for the given class | createLogger | {
"repo_name": "consulo/consulo-sql",
"path": "src/com/dci/intellij/dbn/common/LoggerFactory.java",
"license": "apache-2.0",
"size": 2087
} | [
"com.intellij.openapi.diagnostic.Logger"
] | import com.intellij.openapi.diagnostic.Logger; | import com.intellij.openapi.diagnostic.*; | [
"com.intellij.openapi"
] | com.intellij.openapi; | 2,879,739 |
protected void encodeBufferSuffix(OutputStream a) throws IOException {
super.pStream.println(" \nend");
super.pStream.flush();
} | void function(OutputStream a) throws IOException { super.pStream.println(STR); super.pStream.flush(); } | /**
* encodeBufferSuffix writes the single line containing space (' ') and
* the line containing the word 'end' to the output stream.
*/ | encodeBufferSuffix writes the single line containing space (' ') and the line containing the word 'end' to the output stream | encodeBufferSuffix | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/sun/misc/UUEncoder.java",
"license": "mit",
"size": 6512
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,572,291 |
private void createTableViewer() {
tableViewer = new TableViewer( table );
tableViewer.setUseHashlookup( true );
//following is if we want default sorting... my thought is no...
} | void function() { tableViewer = new TableViewer( table ); tableViewer.setUseHashlookup( true ); } | /**
* Create the viewer.
*/ | Create the viewer | createTableViewer | {
"repo_name": "pkman/droolsjbpm-tools",
"path": "drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/dsl/editor/DSLEditor.java",
"license": "apache-2.0",
"size": 25212
} | [
"org.eclipse.jface.viewers.TableViewer"
] | import org.eclipse.jface.viewers.TableViewer; | import org.eclipse.jface.viewers.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 2,188,697 |
public void addPropertyChangeListener(PropertyChangeListener listener)
{
this.propertyChangeSupport.addPropertyChangeListener(listener);
} | void function(PropertyChangeListener listener) { this.propertyChangeSupport.addPropertyChangeListener(listener); } | /**
* Add the given listener
* @param listener
* the listener to add
*/ | Add the given listener | addPropertyChangeListener | {
"repo_name": "cgd/data-plots",
"path": "src/java/org/jax/analyticgraph/graph/AxisDescription.java",
"license": "gpl-3.0",
"size": 9401
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 778,837 |
@Test
@MediumTest
public void testInvalidMinidumpNameGeneratesNoUploads() throws IOException {
MinidumpUploadJob minidumpUploadJob =
new ExpectNoUploadsMinidumpUploadJobImpl(mTestRule.getExistingCacheDir());
// Note the omitted ".try0" suffix.
File fileUsingLegacyNamingScheme = createMinidumpFileInCrashDir("1_abc.dmp0");
MinidumpUploadTestUtility.uploadMinidumpsSync(
minidumpUploadJob, false );
// The file should not have been touched, nor should any successful upload files have
// appeared.
Assert.assertTrue(fileUsingLegacyNamingScheme.exists());
Assert.assertFalse(new File(mTestRule.getCrashDir(), "1_abc.up0").exists());
Assert.assertFalse(new File(mTestRule.getCrashDir(), "1_abc.up0.try0").exists());
} | void function() throws IOException { MinidumpUploadJob minidumpUploadJob = new ExpectNoUploadsMinidumpUploadJobImpl(mTestRule.getExistingCacheDir()); File fileUsingLegacyNamingScheme = createMinidumpFileInCrashDir(STR); MinidumpUploadTestUtility.uploadMinidumpsSync( minidumpUploadJob, false ); Assert.assertTrue(fileUsingLegacyNamingScheme.exists()); Assert.assertFalse(new File(mTestRule.getCrashDir(), STR).exists()); Assert.assertFalse(new File(mTestRule.getCrashDir(), STR).exists()); } | /**
* Prior to M60, the ".try0" suffix was optional; however now it is not. This test verifies that
* the code rejects minidumps that lack this suffix.
*/ | Prior to M60, the ".try0" suffix was optional; however now it is not. This test verifies that the code rejects minidumps that lack this suffix | testInvalidMinidumpNameGeneratesNoUploads | {
"repo_name": "scheib/chromium",
"path": "components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/MinidumpUploadJobImplTest.java",
"license": "bsd-3-clause",
"size": 17934
} | [
"java.io.File",
"java.io.IOException",
"org.junit.Assert"
] | import java.io.File; import java.io.IOException; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 1,957,329 |
public void setWorkListener(WorkListener workListener) {
this.workListener = workListener;
}
/**
* Specify a custom {@link TaskDecorator} to be applied to any {@link Runnable} | void function(WorkListener workListener) { this.workListener = workListener; } /** * Specify a custom {@link TaskDecorator} to be applied to any {@link Runnable} | /**
* Specify a JCA WorkListener to apply, if any.
* <p>This shared WorkListener instance will be passed on to the
* WorkManager by all {@link #execute} calls on this TaskExecutor.
*/ | Specify a JCA WorkListener to apply, if any. This shared WorkListener instance will be passed on to the WorkManager by all <code>#execute</code> calls on this TaskExecutor | setWorkListener | {
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.tx/org/springframework/jca/work/WorkManagerTaskExecutor.java",
"license": "mit",
"size": 11008
} | [
"javax.resource.spi.work.WorkListener",
"org.springframework.core.task.TaskDecorator"
] | import javax.resource.spi.work.WorkListener; import org.springframework.core.task.TaskDecorator; | import javax.resource.spi.work.*; import org.springframework.core.task.*; | [
"javax.resource",
"org.springframework.core"
] | javax.resource; org.springframework.core; | 1,489,915 |
YangElement.setPackage(NAMESPACE, "ietfInetTypes");
Inet.registerSchema();
} | YangElement.setPackage(NAMESPACE, STR); Inet.registerSchema(); } | /**
* Enable the elements in this namespace to be aware
* of the data model and use the generated classes.
*/ | Enable the elements in this namespace to be aware of the data model and use the generated classes | enable | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/ietfInetTypes/Inet.java",
"license": "apache-2.0",
"size": 1548
} | [
"com.tailf.jnc.YangElement"
] | import com.tailf.jnc.YangElement; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 911,068 |
public static ArrayList<Instruction> recompileHopsDag( StatementBlock sb, ArrayList<Hop> hops,
LocalVariableMap vars, RecompileStatus status, boolean inplace, boolean litreplace, long tid )
throws DMLRuntimeException, HopsException, LopsException, IOException
{
ArrayList<Instruction> newInst = null;
//need for synchronization as we do temp changes in shared hops/lops
//however, we create deep copies for most dags to allow for concurrent recompile
synchronized( hops )
{
LOG.debug ("\n**************** Optimizer (Recompile) *************\nMemory Budget = " +
OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
// prepare hops dag for recompile
if( !inplace ){
// deep copy hop dag (for non-reversable rewrites)
hops = deepCopyHopsDag(hops);
}
else {
// clear existing lops
Hop.resetVisitStatus(hops);
for( Hop hopRoot : hops )
rClearLops( hopRoot );
}
// replace scalar reads with literals
if( !inplace && litreplace ) {
Hop.resetVisitStatus(hops);
for( Hop hopRoot : hops )
rReplaceLiterals( hopRoot, vars, false );
}
// refresh matrix characteristics (update stats)
Hop.resetVisitStatus(hops);
for( Hop hopRoot : hops )
rUpdateStatistics( hopRoot, vars );
// dynamic hop rewrites
if( !inplace ) {
_rewriter.get().rewriteHopDAGs( hops, null );
//update stats after rewrites
Hop.resetVisitStatus(hops);
for( Hop hopRoot : hops )
rUpdateStatistics( hopRoot, vars );
}
// refresh memory estimates (based on updated stats,
// before: init memo table with propagated worst-case estimates,
// after: extract worst-case estimates from memo table
Hop.resetVisitStatus(hops);
MemoTable memo = new MemoTable();
memo.init(hops, status);
Hop.resetVisitStatus(hops);
for( Hop hopRoot : hops )
hopRoot.refreshMemEstimates(memo);
memo.extract(hops, status);
// codegen if enabled
if( ConfigurationManager.getDMLConfig().getBooleanValue(DMLConfig.CODEGEN)
&& SpoofCompiler.RECOMPILE_CODEGEN ) {
Hop.resetVisitStatus(hops);
hops = SpoofCompiler.optimize(hops, true);
}
// construct lops
Dag<Lop> dag = new Dag<Lop>();
for( Hop hopRoot : hops ){
Lop lops = hopRoot.constructLops();
lops.addToDag(dag);
}
// generate runtime instructions (incl piggybacking)
newInst = dag.getJobs(sb, ConfigurationManager.getDMLConfig());
}
// replace thread ids in new instructions
if( tid != 0 ) //only in parfor context
newInst = ProgramConverter.createDeepCopyInstructionSet(newInst, tid, -1, null, null, null, false, false);
// explain recompiled hops / instructions
if( DMLScript.EXPLAIN == ExplainType.RECOMPILE_HOPS ){
LOG.info("EXPLAIN RECOMPILE \nGENERIC (lines "+sb.getBeginLine()+"-"+sb.getEndLine()+"):\n" +
Explain.explainHops(hops, 1));
}
if( DMLScript.EXPLAIN == ExplainType.RECOMPILE_RUNTIME ){
LOG.info("EXPLAIN RECOMPILE \nGENERIC (lines "+sb.getBeginLine()+"-"+sb.getEndLine()+"):\n" +
Explain.explain(newInst, 1));
}
return newInst;
} | static ArrayList<Instruction> function( StatementBlock sb, ArrayList<Hop> hops, LocalVariableMap vars, RecompileStatus status, boolean inplace, boolean litreplace, long tid ) throws DMLRuntimeException, HopsException, LopsException, IOException { ArrayList<Instruction> newInst = null; synchronized( hops ) { LOG.debug (STR + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + STR); if( !inplace ){ hops = deepCopyHopsDag(hops); } else { Hop.resetVisitStatus(hops); for( Hop hopRoot : hops ) rClearLops( hopRoot ); } if( !inplace && litreplace ) { Hop.resetVisitStatus(hops); for( Hop hopRoot : hops ) rReplaceLiterals( hopRoot, vars, false ); } Hop.resetVisitStatus(hops); for( Hop hopRoot : hops ) rUpdateStatistics( hopRoot, vars ); if( !inplace ) { _rewriter.get().rewriteHopDAGs( hops, null ); Hop.resetVisitStatus(hops); for( Hop hopRoot : hops ) rUpdateStatistics( hopRoot, vars ); } Hop.resetVisitStatus(hops); MemoTable memo = new MemoTable(); memo.init(hops, status); Hop.resetVisitStatus(hops); for( Hop hopRoot : hops ) hopRoot.refreshMemEstimates(memo); memo.extract(hops, status); if( ConfigurationManager.getDMLConfig().getBooleanValue(DMLConfig.CODEGEN) && SpoofCompiler.RECOMPILE_CODEGEN ) { Hop.resetVisitStatus(hops); hops = SpoofCompiler.optimize(hops, true); } Dag<Lop> dag = new Dag<Lop>(); for( Hop hopRoot : hops ){ Lop lops = hopRoot.constructLops(); lops.addToDag(dag); } newInst = dag.getJobs(sb, ConfigurationManager.getDMLConfig()); } if( tid != 0 ) newInst = ProgramConverter.createDeepCopyInstructionSet(newInst, tid, -1, null, null, null, false, false); if( DMLScript.EXPLAIN == ExplainType.RECOMPILE_HOPS ){ LOG.info(STR+sb.getBeginLine()+"-"+sb.getEndLine()+"):\n" + Explain.explainHops(hops, 1)); } if( DMLScript.EXPLAIN == ExplainType.RECOMPILE_RUNTIME ){ LOG.info(STR+sb.getBeginLine()+"-"+sb.getEndLine()+"):\n" + Explain.explain(newInst, 1)); } return newInst; } | /**
* A) Recompile basic program block hop DAG.
*
* We support to basic types inplace or via deep copy. Deep copy is the default and is required
* in order to apply non-reversible rewrites. In-place is required in order to modify the existing
* hops (e.g., for parfor pre-recompilation).
*
* @param sb statement block
* @param hops high-level operators
* @param vars local variable map
* @param status the recompile status
* @param inplace true if in place
* @param litreplace true if literal replacement
* @param tid thread id
* @return list of instructions
* @throws DMLRuntimeException if DMLRuntimeException occurs
* @throws HopsException if HopsException occurs
* @throws LopsException if LopsException occurs
* @throws IOException if IOException occurs
*/ | A) Recompile basic program block hop DAG. We support to basic types inplace or via deep copy. Deep copy is the default and is required in order to apply non-reversible rewrites. In-place is required in order to modify the existing hops (e.g., for parfor pre-recompilation) | recompileHopsDag | {
"repo_name": "akchinSTC/systemml",
"path": "src/main/java/org/apache/sysml/hops/recompile/Recompiler.java",
"license": "apache-2.0",
"size": 69607
} | [
"java.io.IOException",
"java.util.ArrayList",
"org.apache.sysml.api.DMLScript",
"org.apache.sysml.conf.ConfigurationManager",
"org.apache.sysml.conf.DMLConfig",
"org.apache.sysml.hops.Hop",
"org.apache.sysml.hops.HopsException",
"org.apache.sysml.hops.MemoTable",
"org.apache.sysml.hops.OptimizerUtil... | import java.io.IOException; import java.util.ArrayList; import org.apache.sysml.api.DMLScript; import org.apache.sysml.conf.ConfigurationManager; import org.apache.sysml.conf.DMLConfig; import org.apache.sysml.hops.Hop; import org.apache.sysml.hops.HopsException; import org.apache.sysml.hops.MemoTable; import org.apache.sysml.hops.OptimizerUtils; import org.apache.sysml.hops.codegen.SpoofCompiler; import org.apache.sysml.lops.Lop; import org.apache.sysml.lops.LopsException; import org.apache.sysml.lops.compile.Dag; import org.apache.sysml.parser.StatementBlock; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.LocalVariableMap; import org.apache.sysml.runtime.controlprogram.parfor.ProgramConverter; import org.apache.sysml.runtime.instructions.Instruction; import org.apache.sysml.utils.Explain; | import java.io.*; import java.util.*; import org.apache.sysml.api.*; import org.apache.sysml.conf.*; import org.apache.sysml.hops.*; import org.apache.sysml.hops.codegen.*; import org.apache.sysml.lops.*; import org.apache.sysml.lops.compile.*; import org.apache.sysml.parser.*; import org.apache.sysml.runtime.*; import org.apache.sysml.runtime.controlprogram.*; import org.apache.sysml.runtime.controlprogram.parfor.*; import org.apache.sysml.runtime.instructions.*; import org.apache.sysml.utils.*; | [
"java.io",
"java.util",
"org.apache.sysml"
] | java.io; java.util; org.apache.sysml; | 2,455,746 |
private void updateRestoreStateOnMaster(final UpdateIndexShardRestoreStatusRequest request) {
logger.trace("received updated snapshot restore state [{}]", request);
updatedSnapshotStateQueue.add(request);
clusterService.submitStateUpdateTask("update snapshot state", new ClusterStateUpdateTask() {
private final List<UpdateIndexShardRestoreStatusRequest> drainedRequests = new ArrayList<>();
private Map<SnapshotId, Tuple<RestoreInfo, ImmutableOpenMap<ShardId, ShardRestoreStatus>>> batchedRestoreInfo = null; | void function(final UpdateIndexShardRestoreStatusRequest request) { logger.trace(STR, request); updatedSnapshotStateQueue.add(request); clusterService.submitStateUpdateTask(STR, new ClusterStateUpdateTask() { private final List<UpdateIndexShardRestoreStatusRequest> drainedRequests = new ArrayList<>(); private Map<SnapshotId, Tuple<RestoreInfo, ImmutableOpenMap<ShardId, ShardRestoreStatus>>> batchedRestoreInfo = null; | /**
* Updates shard restore record in the cluster state.
*
* @param request update shard status request
*/ | Updates shard restore record in the cluster state | updateRestoreStateOnMaster | {
"repo_name": "episerver/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/snapshots/RestoreService.java",
"license": "apache-2.0",
"size": 53820
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.elasticsearch.cluster.ClusterStateUpdateTask",
"org.elasticsearch.cluster.RestoreInProgress",
"org.elasticsearch.cluster.metadata.SnapshotId",
"org.elasticsearch.common.collect.ImmutableOpenMap",
"org.elasticsearch.common.collect.Tuple",
... | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.RestoreInProgress; import org.elasticsearch.cluster.metadata.SnapshotId; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.index.shard.ShardId; | import java.util.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.common.collect.*; import org.elasticsearch.index.shard.*; | [
"java.util",
"org.elasticsearch.cluster",
"org.elasticsearch.common",
"org.elasticsearch.index"
] | java.util; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.index; | 1,526,197 |
@Generated
@Selector("cancelTunnelWithError:")
public native void cancelTunnelWithError(NSError error); | @Selector(STR) native void function(NSError error); | /**
* cancelTunnelWithError:
* <p>
* This function is called by tunnel provider implementations to initiate tunnel destruction when a network error is encountered that renders the tunnel no longer viable. Subclasses should not override this method.
*
* @param error An NSError object containing details about the error that the tunnel provider implementation encountered.
*/ | cancelTunnelWithError: This function is called by tunnel provider implementations to initiate tunnel destruction when a network error is encountered that renders the tunnel no longer viable. Subclasses should not override this method | cancelTunnelWithError | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/networkextension/NEPacketTunnelProvider.java",
"license": "apache-2.0",
"size": 10784
} | [
"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; | 1,447,866 |
public static boolean isAuthenticated() {
SecurityContext securityContext = SecurityContextHolder.getContext();
Collection<? extends GrantedAuthority> authorities = securityContext.getAuthentication().getAuthorities();
if (authorities != null) {
for (GrantedAuthority authority : authorities) {
if (authority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)) {
return false;
}
}
}
return true;
} | static boolean function() { SecurityContext securityContext = SecurityContextHolder.getContext(); Collection<? extends GrantedAuthority> authorities = securityContext.getAuthentication().getAuthorities(); if (authorities != null) { for (GrantedAuthority authority : authorities) { if (authority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)) { return false; } } } return true; } | /**
* Check if a user is authenticated.
*
* @return true if the user is authenticated, false otherwise
*/ | Check if a user is authenticated | isAuthenticated | {
"repo_name": "ludo1026/telosys-tools-saas",
"path": "src/main/java/org/telosystools/saas/security/SecurityUtils.java",
"license": "gpl-3.0",
"size": 2643
} | [
"java.util.Collection",
"org.springframework.security.core.GrantedAuthority",
"org.springframework.security.core.context.SecurityContext",
"org.springframework.security.core.context.SecurityContextHolder"
] | import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; | import java.util.*; import org.springframework.security.core.*; import org.springframework.security.core.context.*; | [
"java.util",
"org.springframework.security"
] | java.util; org.springframework.security; | 2,466,288 |
String getNodeAttr(final Node node, final String name)
{
final Node attr = node.getAttributes().getNamedItem(name);
if (attr == null || attr.getNodeValue().isEmpty())
{
throw new SbToolsRuntimeException(node.getNodeName() + " has no attribute " + name + " or it is empty");
}
return attr.getNodeValue();
} | String getNodeAttr(final Node node, final String name) { final Node attr = node.getAttributes().getNamedItem(name); if (attr == null attr.getNodeValue().isEmpty()) { throw new SbToolsRuntimeException(node.getNodeName() + STR + name + STR); } return attr.getNodeValue(); } | /**
* Get an attribute of a DOM node.
*
* @param node - the node to process
* @param name - the name of the attribute to fetch
*
* @return The value of the attribute
*
* @throws SbToolsRuntimeException if the node does not contain the attribute or if the attribute
* is empty
*/ | Get an attribute of a DOM node | getNodeAttr | {
"repo_name": "selfbus/tools-libraries",
"path": "sbtools-common-gui/src/main/java/org/selfbus/sbtools/common/gui/window/XmlToolBarFactory.java",
"license": "gpl-3.0",
"size": 5211
} | [
"org.selfbus.sbtools.common.gui.misc.SbToolsRuntimeException",
"org.w3c.dom.Node"
] | import org.selfbus.sbtools.common.gui.misc.SbToolsRuntimeException; import org.w3c.dom.Node; | import org.selfbus.sbtools.common.gui.misc.*; import org.w3c.dom.*; | [
"org.selfbus.sbtools",
"org.w3c.dom"
] | org.selfbus.sbtools; org.w3c.dom; | 388,400 |
protected Collection getEdges_internal() {
HashSet edges = new HashSet();
Collection inEdgeSets = getPredsToInEdges().values();
Collection outEdgeSets = getSuccsToOutEdges().values();
for (Iterator e_iter = inEdgeSets.iterator(); e_iter.hasNext(); )
edges.addAll((Set)e_iter.next());
for (Iterator e_iter = outEdgeSets.iterator(); e_iter.hasNext(); )
edges.addAll((Set)e_iter.next());
return edges;
} | Collection function() { HashSet edges = new HashSet(); Collection inEdgeSets = getPredsToInEdges().values(); Collection outEdgeSets = getSuccsToOutEdges().values(); for (Iterator e_iter = inEdgeSets.iterator(); e_iter.hasNext(); ) edges.addAll((Set)e_iter.next()); for (Iterator e_iter = outEdgeSets.iterator(); e_iter.hasNext(); ) edges.addAll((Set)e_iter.next()); return edges; } | /**
* Returns a list of all incident edges of this vertex.
* Requires time proportional to the number of incident edges.
*
* @see AbstractSparseVertex#getEdges_internal()
*/ | Returns a list of all incident edges of this vertex. Requires time proportional to the number of incident edges | getEdges_internal | {
"repo_name": "markus1978/clickwatch",
"path": "external/edu.uci.ics.jung/src/edu/uci/ics/jung/graph/impl/DirectedSparseVertex.java",
"license": "apache-2.0",
"size": 5947
} | [
"java.util.Collection",
"java.util.HashSet",
"java.util.Iterator",
"java.util.Set"
] | import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,591,985 |
static HashMap<String, SettingSection> readFile(final File ini, boolean isCustomGame,
SettingsActivityView view)
{
HashMap<String, SettingSection> sections = new Settings.SettingsSectionMap();
BufferedReader reader = null;
try
{
reader = new BufferedReader(new FileReader(ini));
SettingSection current = null;
for (String line; (line = reader.readLine()) != null; )
{
if (line.startsWith("[") && line.endsWith("]"))
{
current = sectionFromLine(line, isCustomGame);
sections.put(current.getName(), current);
}
else if ((current != null))
{
Setting setting = settingFromLine(current, line);
if (setting != null)
{
current.putSetting(setting);
}
}
}
}
catch (FileNotFoundException e)
{
Log.error("[SettingsFile] File not found: " + ini.getAbsolutePath() + e.getMessage());
if (view != null)
view.onSettingsFileNotFound();
}
catch (IOException e)
{
Log.error("[SettingsFile] Error reading from: " + ini.getAbsolutePath() + e.getMessage());
if (view != null)
view.onSettingsFileNotFound();
}
finally
{
if (reader != null)
{
try
{
reader.close();
}
catch (IOException e)
{
Log.error("[SettingsFile] Error closing: " + ini.getAbsolutePath() + e.getMessage());
}
}
}
return sections;
} | static HashMap<String, SettingSection> readFile(final File ini, boolean isCustomGame, SettingsActivityView view) { HashMap<String, SettingSection> sections = new Settings.SettingsSectionMap(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(ini)); SettingSection current = null; for (String line; (line = reader.readLine()) != null; ) { if (line.startsWith("[") && line.endsWith("]")) { current = sectionFromLine(line, isCustomGame); sections.put(current.getName(), current); } else if ((current != null)) { Setting setting = settingFromLine(current, line); if (setting != null) { current.putSetting(setting); } } } } catch (FileNotFoundException e) { Log.error(STR + ini.getAbsolutePath() + e.getMessage()); if (view != null) view.onSettingsFileNotFound(); } catch (IOException e) { Log.error(STR + ini.getAbsolutePath() + e.getMessage()); if (view != null) view.onSettingsFileNotFound(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { Log.error(STR + ini.getAbsolutePath() + e.getMessage()); } } } return sections; } | /**
* Reads a given .ini file from disk and returns it as a HashMap of Settings, themselves
* effectively a HashMap of key/value settings. If unsuccessful, outputs an error telling why it
* failed.
*
* @param ini The ini file to load the settings from
* @param view The current view.
*/ | Reads a given .ini file from disk and returns it as a HashMap of Settings, themselves effectively a HashMap of key/value settings. If unsuccessful, outputs an error telling why it failed | readFile | {
"repo_name": "JonnyH/dolphin",
"path": "Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java",
"license": "gpl-2.0",
"size": 31143
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileReader",
"java.io.IOException",
"java.util.HashMap",
"org.dolphinemu.dolphinemu.features.settings.model.Setting",
"org.dolphinemu.dolphinemu.features.settings.model.SettingSection",
"org.dolphinemu.dolphinemu.fea... | import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import org.dolphinemu.dolphinemu.features.settings.model.Setting; import org.dolphinemu.dolphinemu.features.settings.model.SettingSection; import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsActivityView; import org.dolphinemu.dolphinemu.utils.Log; | import java.io.*; import java.util.*; import org.dolphinemu.dolphinemu.features.settings.model.*; import org.dolphinemu.dolphinemu.features.settings.ui.*; import org.dolphinemu.dolphinemu.utils.*; | [
"java.io",
"java.util",
"org.dolphinemu.dolphinemu"
] | java.io; java.util; org.dolphinemu.dolphinemu; | 523,723 |
public static void initLibraries(HashMap<String, String[]> libraries)
{
libraries.put("mockup",
new String[] { SHAPES_PATH + "/mockup/mxMockupButtons.js" });
libraries.put("arrows2", new String[] { SHAPES_PATH + "/mxArrows.js" });
libraries.put("bpmn",
new String[] { SHAPES_PATH + "/bpmn/mxBpmnShape2.js",
STENCIL_PATH + "/bpmn.xml" });
libraries.put("er", new String[] { SHAPES_PATH + "/er/mxER.js" });
libraries.put("ios",
new String[] { SHAPES_PATH + "/mockup/mxMockupiOS.js" });
libraries.put("rackGeneral",
new String[] { SHAPES_PATH + "/rack/mxRack.js",
STENCIL_PATH + "/rack/general.xml" });
libraries.put("rackF5", new String[] { STENCIL_PATH + "/rack/f5.xml" });
libraries.put("lean_mapping",
new String[] { SHAPES_PATH + "/mxLeanMap.js",
STENCIL_PATH + "/lean_mapping.xml" });
libraries.put("basic", new String[] { SHAPES_PATH + "/mxBasic.js",
STENCIL_PATH + "/basic.xml" });
libraries.put("ios7icons",
new String[] { STENCIL_PATH + "/ios7/icons.xml" });
libraries.put("ios7ui",
new String[] { SHAPES_PATH + "/ios7/mxIOS7Ui.js",
STENCIL_PATH + "/ios7/misc.xml" });
libraries.put("android", new String[] { SHAPES_PATH + "/mxAndroid.js",
STENCIL_PATH + "electrical/transmission" });
libraries.put("electrical/transmission",
new String[] { SHAPES_PATH + "/mxElectrical.js",
STENCIL_PATH + "/electrical/transmission.xml" });
libraries.put("mockup/buttons",
new String[] { SHAPES_PATH + "/mockup/mxMockupButtons.js" });
libraries.put("mockup/containers",
new String[] { SHAPES_PATH + "/mockup/mxMockupContainers.js" });
libraries.put("mockup/forms",
new String[] { SHAPES_PATH + "/mockup/mxMockupForms.js" });
libraries.put("mockup/graphics",
new String[] { SHAPES_PATH + "/mockup/mxMockupGraphics.js",
STENCIL_PATH + "/mockup/misc.xml" });
libraries.put("mockup/markup",
new String[] { SHAPES_PATH + "/mockup/mxMockupMarkup.js" });
libraries.put("mockup/misc",
new String[] { SHAPES_PATH + "/mockup/mxMockupMisc.js",
STENCIL_PATH + "/mockup/misc.xml" });
libraries.put("mockup/navigation",
new String[] { SHAPES_PATH + "/mockup/mxMockupNavigation.js",
STENCIL_PATH + "/mockup/misc.xml" });
libraries.put("mockup/text",
new String[] { SHAPES_PATH + "/mockup/mxMockupText.js" });
libraries.put("floorplan",
new String[] { SHAPES_PATH + "/mxFloorplan.js",
STENCIL_PATH + "/floorplan.xml" });
libraries.put("bootstrap",
new String[] { SHAPES_PATH + "/mxBootstrap.js",
STENCIL_PATH + "/bootstrap.xml" });
libraries.put("gmdl", new String[] { SHAPES_PATH + "/mxGmdl.js",
STENCIL_PATH + "/gmdl.xml" });
libraries.put("cabinets", new String[] { SHAPES_PATH + "/mxCabinets.js",
STENCIL_PATH + "/cabinets.xml" });
libraries.put("archimate",
new String[] { SHAPES_PATH + "/mxArchiMate.js" });
libraries.put("archimate3",
new String[] { SHAPES_PATH + "/mxArchiMate3.js" });
libraries.put("sysml", new String[] { SHAPES_PATH + "/mxSysML.js" });
libraries.put("eip", new String[] { SHAPES_PATH + "/mxEip.js",
STENCIL_PATH + "/eip.xml" });
libraries.put("networks", new String[] { SHAPES_PATH + "/mxNetworks.js",
STENCIL_PATH + "/networks.xml" });
libraries.put("aws3d", new String[] { SHAPES_PATH + "/mxAWS3D.js",
STENCIL_PATH + "/aws3d.xml" });
libraries.put("pid2inst",
new String[] { SHAPES_PATH + "/pid2/mxPidInstruments.js" });
libraries.put("pid2misc",
new String[] { SHAPES_PATH + "/pid2/mxPidMisc.js",
STENCIL_PATH + "/pid/misc.xml" });
libraries.put("pid2valves",
new String[] { SHAPES_PATH + "/pid2/mxPidValves.js" });
libraries.put("pidFlowSensors",
new String[] { STENCIL_PATH + "/pid/flow_sensors.xml" });
} | static void function(HashMap<String, String[]> libraries) { libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put("bpmn", new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put("er", new String[] { SHAPES_PATH + STR }); libraries.put("ios", new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put("basic", new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put("gmdl", new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put("sysml", new String[] { SHAPES_PATH + STR }); libraries.put("eip", new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put("aws3d", new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR, STENCIL_PATH + STR }); libraries.put(STR, new String[] { SHAPES_PATH + STR }); libraries.put(STR, new String[] { STENCIL_PATH + STR }); } | /**
* Sets up collection of stencils
*/ | Sets up collection of stencils | initLibraries | {
"repo_name": "jgraph/drawio",
"path": "src/main/java/com/mxgraph/online/EmbedServlet2.java",
"license": "apache-2.0",
"size": 13757
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,892,157 |
private ValidationResult validateParameterInteger(Map<String,String> properties) {
String val = properties.get(PARAMETER_NAME_INTEGER);
int intValue = -1;
try {
checkInteger(val);
} catch (NumberFormatException nfe) {
return new MyValidationResult(false, "Must be an integer");
}
return ValidationResult.SUCCESS;
} | ValidationResult function(Map<String,String> properties) { String val = properties.get(PARAMETER_NAME_INTEGER); int intValue = -1; try { checkInteger(val); } catch (NumberFormatException nfe) { return new MyValidationResult(false, STR); } return ValidationResult.SUCCESS; } | /**
* Validates the parameter Integer.
*
* @param properties the view instance parameters
* @return the validation result
*/ | Validates the parameter Integer | validateParameterInteger | {
"repo_name": "arenadata/ambari",
"path": "ambari-views/examples/property-validator-view/src/main/java/org/apache/ambari/view/property/MyValidator.java",
"license": "apache-2.0",
"size": 7937
} | [
"java.util.Map",
"org.apache.ambari.view.validation.ValidationResult"
] | import java.util.Map; import org.apache.ambari.view.validation.ValidationResult; | import java.util.*; import org.apache.ambari.view.validation.*; | [
"java.util",
"org.apache.ambari"
] | java.util; org.apache.ambari; | 207,927 |
public void setName(final String name) throws CouldntSaveDataException {
Preconditions.checkNotNull(name, "IE00049: Name argument can not be null");
if (m_name.equals(name)) {
return;
}
m_provider.setName(m_addressSpace, name);
m_name = name;
for (final IAddressSpaceConfigurationListener listener : m_listeners) {
try {
listener.changedName(m_addressSpace, name);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
updateModificationDate();
} | void function(final String name) throws CouldntSaveDataException { Preconditions.checkNotNull(name, STR); if (m_name.equals(name)) { return; } m_provider.setName(m_addressSpace, name); m_name = name; for (final IAddressSpaceConfigurationListener listener : m_listeners) { try { listener.changedName(m_addressSpace, name); } catch (final Exception exception) { CUtilityFunctions.logException(exception); } } updateModificationDate(); } | /**
* Sets the name of the address space.
*
* @param name The new name of the address space.
*
* @throws CouldntSaveDataException Thrown if the new name could not be written to the database.
*/ | Sets the name of the address space | setName | {
"repo_name": "google/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/AddressSpaces/CAddressSpaceConfiguration.java",
"license": "apache-2.0",
"size": 10654
} | [
"com.google.common.base.Preconditions",
"com.google.security.zynamics.binnavi.CUtilityFunctions",
"com.google.security.zynamics.binnavi.Database"
] | import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.CUtilityFunctions; import com.google.security.zynamics.binnavi.Database; | import com.google.common.base.*; import com.google.security.zynamics.binnavi.*; | [
"com.google.common",
"com.google.security"
] | com.google.common; com.google.security; | 2,134,975 |
public void considerCandidatePlan(CompiledPlan plan, AbstractParsedStmt parsedStmt) {
//System.out.println(String.format("[Raw plan]:%n%s", rawplan.rootPlanGraph.toExplainPlanString()));
// run the set of microptimizations, which may return many plans (or not)
ScanDeterminizer.apply(plan, m_detMode);
// add in the sql to the plan
plan.sql = m_sql;
// compute resource usage using the single stats collector
m_stats = new PlanStatistics();
AbstractPlanNode planGraph = plan.rootPlanGraph;
// compute statistics about a plan
planGraph.computeEstimatesRecursively(m_stats, m_cluster, m_db, m_estimates, m_paramHints);
// compute the cost based on the resources using the current cost model
plan.cost = m_costModel.getPlanCost(m_stats);
// filename for debug output
String filename = String.valueOf(m_planId++);
/ System.out.println("DEBUG [new plan]: Cost:" + plan.cost + plan.rootPlanGraph.toExplainPlanString());
// find the minimum cost plan
if (m_bestPlan == null || plan.cost < m_bestPlan.cost) {
// free the PlanColumns held by the previous best plan
m_bestPlan = plan;
m_bestFilename = filename;
/ System.out.println("DEBUG [Best plan] updated ***\n");
}
outputPlan(plan, planGraph, filename);
} | void function(CompiledPlan plan, AbstractParsedStmt parsedStmt) { ScanDeterminizer.apply(plan, m_detMode); plan.sql = m_sql; m_stats = new PlanStatistics(); AbstractPlanNode planGraph = plan.rootPlanGraph; planGraph.computeEstimatesRecursively(m_stats, m_cluster, m_db, m_estimates, m_paramHints); plan.cost = m_costModel.getPlanCost(m_stats); String filename = String.valueOf(m_planId++); / System.out.println(STR + plan.cost + plan.rootPlanGraph.toExplainPlanString()); if (m_bestPlan == null plan.cost < m_bestPlan.cost) { m_bestPlan = plan; m_bestFilename = filename; / System.out.println(STR); } outputPlan(plan, planGraph, filename); } | /** Picks the best cost plan for a given raw plan
* @param rawplan
*/ | Picks the best cost plan for a given raw plan | considerCandidatePlan | {
"repo_name": "zheguang/voltdb",
"path": "src/frontend/org/voltdb/planner/PlanSelector.java",
"license": "agpl-3.0",
"size": 12115
} | [
"org.voltdb.plannodes.AbstractPlanNode"
] | import org.voltdb.plannodes.AbstractPlanNode; | import org.voltdb.plannodes.*; | [
"org.voltdb.plannodes"
] | org.voltdb.plannodes; | 440,327 |
public static void cleanup() {
for (String temp : files) {
new File(temp).delete();
}
// Cleaning up the files list
files.clear();
} | static void function() { for (String temp : files) { new File(temp).delete(); } files.clear(); } | /**
* This method is used to cleanup all the files already downloaded
*/ | This method is used to cleanup all the files already downloaded | cleanup | {
"repo_name": "mengchen2/SeLion_Demo",
"path": "server/src/main/java/com/paypal/selion/utils/FileDownloader.java",
"license": "apache-2.0",
"size": 13183
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,536,720 |
@Nonnull
public static String getPackageName(@Nullable Class<?> cls) {
if (cls == null) {
return EMPTY_STRING;
}
return getPackageName(cls.getName());
} | static String function(@Nullable Class<?> cls) { if (cls == null) { return EMPTY_STRING; } return getPackageName(cls.getName()); } | /**
* <p>Gets the package name of a <code>Class</code>.</p>
*
* @param cls the class to get the package name for, may be <code>null</code>.
* @return the package name or an empty string
*/ | Gets the package name of a <code>Class</code> | getPackageName | {
"repo_name": "levymoreira/griffon",
"path": "subprojects/griffon-core/src/main/java/griffon/util/GriffonClassUtils.java",
"license": "apache-2.0",
"size": 129659
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 235,230 |
public void showPage(int pagenum) {
pageShown(pagenum);
SwingUtilities.invokeLater(new GotoLater(pagenum));
}
class GotoLater implements Runnable {
int page;
public GotoLater(int pagenum) {
page = pagenum;
} | void function(int pagenum) { pageShown(pagenum); SwingUtilities.invokeLater(new GotoLater(pagenum)); } class GotoLater implements Runnable { int page; public GotoLater(int pagenum) { page = pagenum; } | /**
* Notifies the listeners that a page has been selected. Performs
* the notification in the AWT thread.
* Also highlights the selected page. Does this first so that feedback
* is immediate.
*/ | Notifies the listeners that a page has been selected. Performs the notification in the AWT thread. Also highlights the selected page. Does this first so that feedback is immediate | showPage | {
"repo_name": "HarmonyEnterpriseSolutions/harmony-platform",
"path": "java/src/com/sun/pdfview/ThumbPanel.java",
"license": "gpl-2.0",
"size": 12748
} | [
"javax.swing.SwingUtilities"
] | import javax.swing.SwingUtilities; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 867,079 |
public LabelBuilder bold() {
label.setFont(label.getFont().deriveFont(Font.BOLD));
return this;
} | LabelBuilder function() { label.setFont(label.getFont().deriveFont(Font.BOLD)); return this; } | /**
* Make the label font bold.
*/ | Make the label font bold | bold | {
"repo_name": "jonestimd/swing-extensions",
"path": "src/main/java/io/github/jonestimd/swing/LabelBuilder.java",
"license": "mit",
"size": 4709
} | [
"java.awt.Font"
] | import java.awt.Font; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,119,116 |
public static Network findFirstHostNetwork(HostSystem host) {
Network network = null;
Network[] networks = null;
if (host != null) {
try {
networks = host.getNetworks();
if (networks != null && networks.length > 0) {
network = networks[0];
LOGGER.info("Network found : " + network.getName());
}
} catch (RemoteException ex) {
LOGGER.error("Error while allocating a network from host: " + host.getName());
}
}
return network;
} | static Network function(HostSystem host) { Network network = null; Network[] networks = null; if (host != null) { try { networks = host.getNetworks(); if (networks != null && networks.length > 0) { network = networks[0]; LOGGER.info(STR + network.getName()); } } catch (RemoteException ex) { LOGGER.error(STR + host.getName()); } } return network; } | /**
* Find the first Host network.
*/ | Find the first Host network | findFirstHostNetwork | {
"repo_name": "occiware/Multi-Cloud-Studio",
"path": "plugins/org.eclipse.cmf.occi.multicloud.vmware.connector/src/org/ecplise/cmf/occi/multicloud/vmware/connector/driver/HostHelper.java",
"license": "epl-1.0",
"size": 4466
} | [
"com.vmware.vim25.mo.HostSystem",
"com.vmware.vim25.mo.Network",
"java.rmi.RemoteException"
] | import com.vmware.vim25.mo.HostSystem; import com.vmware.vim25.mo.Network; import java.rmi.RemoteException; | import com.vmware.vim25.mo.*; import java.rmi.*; | [
"com.vmware.vim25",
"java.rmi"
] | com.vmware.vim25; java.rmi; | 303,743 |
public static String createHash(String password)
throws NoSuchAlgorithmException, InvalidKeySpecException {
return createHash(password.toCharArray());
} | static String function(String password) throws NoSuchAlgorithmException, InvalidKeySpecException { return createHash(password.toCharArray()); } | /**
* Returns a salted PBKDF2 hash of the password.
*
* @param password
* the password to hash
* @return a salted PBKDF2 hash of the password
*/ | Returns a salted PBKDF2 hash of the password | createHash | {
"repo_name": "machadolucas/watchout",
"path": "src/main/java/com/riskvis/util/PasswordHash.java",
"license": "apache-2.0",
"size": 5316
} | [
"java.security.NoSuchAlgorithmException",
"java.security.spec.InvalidKeySpecException"
] | import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; | import java.security.*; import java.security.spec.*; | [
"java.security"
] | java.security; | 74,661 |
public void registerCommand(String command) {
holder.put(command, new AtomicReference<BroadcastStatus>(BroadcastStatus.Idle));
}
| void function(String command) { holder.put(command, new AtomicReference<BroadcastStatus>(BroadcastStatus.Idle)); } | /**
* Maps a command to a broadcast status.
*/ | Maps a command to a broadcast status | registerCommand | {
"repo_name": "deleidos/digitaledge-platform",
"path": "commons-core/src/main/java/com/deleidos/rtws/commons/net/listener/executor/BroadcastStatusMap.java",
"license": "apache-2.0",
"size": 14331
} | [
"com.deleidos.rtws.commons.net.listener.common.BroadcastStatus",
"java.util.concurrent.atomic.AtomicReference"
] | import com.deleidos.rtws.commons.net.listener.common.BroadcastStatus; import java.util.concurrent.atomic.AtomicReference; | import com.deleidos.rtws.commons.net.listener.common.*; import java.util.concurrent.atomic.*; | [
"com.deleidos.rtws",
"java.util"
] | com.deleidos.rtws; java.util; | 2,573,330 |
@Test
public void Broken_testSync() throws Exception {
TableName tableName = TableName.valueOf(currentTest.getMethodName());
MultiVersionConcurrencyControl mvcc = new MultiVersionConcurrencyControl(1);
// First verify that using streams all works.
Path p = new Path(dir, currentTest.getMethodName() + ".fsdos");
FSDataOutputStream out = fs.create(p);
out.write(tableName.getName());
Method syncMethod = null;
try {
syncMethod = out.getClass().getMethod("hflush", new Class<?> []{});
} catch (NoSuchMethodException e) {
try {
syncMethod = out.getClass().getMethod("sync", new Class<?> []{});
} catch (NoSuchMethodException ex) {
fail("This version of Hadoop supports neither Syncable.sync() " +
"nor Syncable.hflush().");
}
}
syncMethod.invoke(out, new Object[]{});
FSDataInputStream in = fs.open(p);
assertTrue(in.available() > 0);
byte [] buffer = new byte [1024];
int read = in.read(buffer);
assertEquals(tableName.getName().length, read);
out.close();
in.close();
final int total = 20;
WAL.Reader reader = null;
try {
RegionInfo info = RegionInfoBuilder.newBuilder(tableName).build();
NavigableMap<byte[], Integer> scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(tableName.getName(), 0);
final WAL wal = wals.getWAL(info);
for (int i = 0; i < total; i++) {
WALEdit kvs = new WALEdit();
kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), tableName.getName()));
wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName,
EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs);
}
// Now call sync and try reading. Opening a Reader before you sync just
// gives you EOFE.
wal.sync();
// Open a Reader.
Path walPath = AbstractFSWALProvider.getCurrentFileName(wal);
reader = wals.createReader(fs, walPath);
int count = 0;
WAL.Entry entry = new WAL.Entry();
while ((entry = reader.next(entry)) != null) count++;
assertEquals(total, count);
reader.close();
// Add test that checks to see that an open of a Reader works on a file
// that has had a sync done on it.
for (int i = 0; i < total; i++) {
WALEdit kvs = new WALEdit();
kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), tableName.getName()));
wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName,
EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs);
}
wal.sync();
reader = wals.createReader(fs, walPath);
count = 0;
while((entry = reader.next(entry)) != null) count++;
assertTrue(count >= total);
reader.close();
// If I sync, should see double the edits.
wal.sync();
reader = wals.createReader(fs, walPath);
count = 0;
while((entry = reader.next(entry)) != null) count++;
assertEquals(total * 2, count);
reader.close();
// Now do a test that ensures stuff works when we go over block boundary,
// especially that we return good length on file.
final byte [] value = new byte[1025 * 1024]; // Make a 1M value.
for (int i = 0; i < total; i++) {
WALEdit kvs = new WALEdit();
kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), value));
wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName,
EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs);
}
// Now I should have written out lots of blocks. Sync then read.
wal.sync();
reader = wals.createReader(fs, walPath);
count = 0;
while((entry = reader.next(entry)) != null) count++;
assertEquals(total * 3, count);
reader.close();
// shutdown and ensure that Reader gets right length also.
wal.shutdown();
reader = wals.createReader(fs, walPath);
count = 0;
while((entry = reader.next(entry)) != null) count++;
assertEquals(total * 3, count);
reader.close();
} finally {
if (reader != null) reader.close();
}
} | void function() throws Exception { TableName tableName = TableName.valueOf(currentTest.getMethodName()); MultiVersionConcurrencyControl mvcc = new MultiVersionConcurrencyControl(1); Path p = new Path(dir, currentTest.getMethodName() + STR); FSDataOutputStream out = fs.create(p); out.write(tableName.getName()); Method syncMethod = null; try { syncMethod = out.getClass().getMethod(STR, new Class<?> []{}); } catch (NoSuchMethodException e) { try { syncMethod = out.getClass().getMethod("sync", new Class<?> []{}); } catch (NoSuchMethodException ex) { fail(STR + STR); } } syncMethod.invoke(out, new Object[]{}); FSDataInputStream in = fs.open(p); assertTrue(in.available() > 0); byte [] buffer = new byte [1024]; int read = in.read(buffer); assertEquals(tableName.getName().length, read); out.close(); in.close(); final int total = 20; WAL.Reader reader = null; try { RegionInfo info = RegionInfoBuilder.newBuilder(tableName).build(); NavigableMap<byte[], Integer> scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR); scopes.put(tableName.getName(), 0); final WAL wal = wals.getWAL(info); for (int i = 0; i < total; i++) { WALEdit kvs = new WALEdit(); kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), tableName.getName())); wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName, EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs); } wal.sync(); Path walPath = AbstractFSWALProvider.getCurrentFileName(wal); reader = wals.createReader(fs, walPath); int count = 0; WAL.Entry entry = new WAL.Entry(); while ((entry = reader.next(entry)) != null) count++; assertEquals(total, count); reader.close(); for (int i = 0; i < total; i++) { WALEdit kvs = new WALEdit(); kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), tableName.getName())); wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName, EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs); } wal.sync(); reader = wals.createReader(fs, walPath); count = 0; while((entry = reader.next(entry)) != null) count++; assertTrue(count >= total); reader.close(); wal.sync(); reader = wals.createReader(fs, walPath); count = 0; while((entry = reader.next(entry)) != null) count++; assertEquals(total * 2, count); reader.close(); final byte [] value = new byte[1025 * 1024]; for (int i = 0; i < total; i++) { WALEdit kvs = new WALEdit(); kvs.add(new KeyValue(Bytes.toBytes(i), tableName.getName(), value)); wal.appendData(info, new WALKeyImpl(info.getEncodedNameAsBytes(), tableName, EnvironmentEdgeManager.currentTime(), mvcc, scopes), kvs); } wal.sync(); reader = wals.createReader(fs, walPath); count = 0; while((entry = reader.next(entry)) != null) count++; assertEquals(total * 3, count); reader.close(); wal.shutdown(); reader = wals.createReader(fs, walPath); count = 0; while((entry = reader.next(entry)) != null) count++; assertEquals(total * 3, count); reader.close(); } finally { if (reader != null) reader.close(); } } | /**
* Test new HDFS-265 sync.
* @throws Exception
*/ | Test new HDFS-265 sync | Broken_testSync | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java",
"license": "apache-2.0",
"size": 36493
} | [
"java.lang.reflect.Method",
"java.util.NavigableMap",
"java.util.TreeMap",
"org.apache.hadoop.fs.FSDataInputStream",
"org.apache.hadoop.fs.FSDataOutputStream",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.KeyValue",
"org.apache.hadoop.hbase.TableName",
"org.apache.hadoop.hbase.client.Region... | import java.lang.reflect.Method; import java.util.NavigableMap; import java.util.TreeMap; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionInfoBuilder; import org.apache.hadoop.hbase.regionserver.MultiVersionConcurrencyControl; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.junit.Assert; | import java.lang.reflect.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.junit.*; | [
"java.lang",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.lang; java.util; org.apache.hadoop; org.junit; | 1,421,423 |
private static void fillInGOOGLEDRIVESecuritySpecificationMap(Map<String, Object> newMap, Specification ds) {
List<Map<String,String>> accessTokenList = new ArrayList<Map<String,String>>();
for (int i = 0; i < ds.getChildCount(); i++) {
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(JOB_ACCESS_NODE_TYPE)) {
String token = sn.getAttributeValue(JOB_TOKEN_ATTRIBUTE);
Map<String,String> accessMap = new HashMap<String,String>();
accessMap.put("TOKEN",token);
accessTokenList.add(accessMap);
}
}
newMap.put("ACCESSTOKENS", accessTokenList);
} | static void function(Map<String, Object> newMap, Specification ds) { List<Map<String,String>> accessTokenList = new ArrayList<Map<String,String>>(); for (int i = 0; i < ds.getChildCount(); i++) { SpecificationNode sn = ds.getChild(i); if (sn.getType().equals(JOB_ACCESS_NODE_TYPE)) { String token = sn.getAttributeValue(JOB_TOKEN_ATTRIBUTE); Map<String,String> accessMap = new HashMap<String,String>(); accessMap.put("TOKEN",token); accessTokenList.add(accessMap); } } newMap.put(STR, accessTokenList); } | /**
* Fill in specification Velocity parameter map for GOOGLEDRIVESecurity tab.
*/ | Fill in specification Velocity parameter map for GOOGLEDRIVESecurity tab | fillInGOOGLEDRIVESecuritySpecificationMap | {
"repo_name": "kishorejangid/manifoldcf",
"path": "connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java",
"license": "apache-2.0",
"size": 59614
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.apache.manifoldcf.core.interfaces.Specification",
"org.apache.manifoldcf.core.interfaces.SpecificationNode"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.manifoldcf.core.interfaces.Specification; import org.apache.manifoldcf.core.interfaces.SpecificationNode; | import java.util.*; import org.apache.manifoldcf.core.interfaces.*; | [
"java.util",
"org.apache.manifoldcf"
] | java.util; org.apache.manifoldcf; | 240,170 |
@Pointcut("if()")
public static boolean isConfigEnabled() {
if (!isSet) {
String config = System.getProperty(APIConstants.ENABLE_CORRELATION_LOGS);
if (StringUtils.isNotEmpty(config)) {
isEnabled = Boolean.parseBoolean(config);
isSet = true;
}
}
return isEnabled;
} | @Pointcut("if()") static boolean function() { if (!isSet) { String config = System.getProperty(APIConstants.ENABLE_CORRELATION_LOGS); if (StringUtils.isNotEmpty(config)) { isEnabled = Boolean.parseBoolean(config); isSet = true; } } return isEnabled; } | /**
* This pointcut looks for the system property to enable/ disable timing logs
*
* @return true if the property value is given as true
*/ | This pointcut looks for the system property to enable/ disable timing logs | isConfigEnabled | {
"repo_name": "ruks/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.cleanup.service/src/main/java/org/wso2/carbon/apimgt/cleanup/service/MethodTimeLogger.java",
"license": "apache-2.0",
"size": 4917
} | [
"org.apache.commons.lang3.StringUtils",
"org.aspectj.lang.annotation.Pointcut",
"org.wso2.carbon.apimgt.impl.APIConstants"
] | import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.annotation.Pointcut; import org.wso2.carbon.apimgt.impl.APIConstants; | import org.apache.commons.lang3.*; import org.aspectj.lang.annotation.*; import org.wso2.carbon.apimgt.impl.*; | [
"org.apache.commons",
"org.aspectj.lang",
"org.wso2.carbon"
] | org.apache.commons; org.aspectj.lang; org.wso2.carbon; | 1,348,221 |
public static <K, V> BinaryFunction<K, Map<K, V>, V> getMapValueFrom(
Map<K, V> rMap)
{
return Functions.swapParams(new GetMapValue<K, V>(null), rMap);
} | static <K, V> BinaryFunction<K, Map<K, V>, V> function( Map<K, V> rMap) { return Functions.swapParams(new GetMapValue<K, V>(null), rMap); } | /***************************************
* Returns a new function instance that returns a value from a certain map.
* The key of the value to return will be the (left) input parameter of the
* returned function. This is the swapped parameter version of the function
* returned by {@link #getMapValue(Object)}.
*
* @param rMap The map to retrieve the value from
*
* @return A new function instance
*/ | Returns a new function instance that returns a value from a certain map. The key of the value to return will be the (left) input parameter of the returned function. This is the swapped parameter version of the function returned by <code>#getMapValue(Object)</code> | getMapValueFrom | {
"repo_name": "esoco/objectrelations",
"path": "src/main/java/de/esoco/lib/expression/CollectionFunctions.java",
"license": "apache-2.0",
"size": 19051
} | [
"de.esoco.lib.expression.function.GetElement",
"java.util.Map"
] | import de.esoco.lib.expression.function.GetElement; import java.util.Map; | import de.esoco.lib.expression.function.*; import java.util.*; | [
"de.esoco.lib",
"java.util"
] | de.esoco.lib; java.util; | 2,057,409 |
@Override
public void setProjectAttributes(List<Attribute> attributes) {
List<AttributeViewImpl> attributeWidgets = Lists.newArrayList();
for (Attribute attribute : attributes) {
attributeWidgets.add(createAttributeWidget(attribute));
} | void function(List<Attribute> attributes) { List<AttributeViewImpl> attributeWidgets = Lists.newArrayList(); for (Attribute attribute : attributes) { attributeWidgets.add(createAttributeWidget(attribute)); } | /**
* Updates the UI to display the given set of Attributes.
*/ | Updates the UI to display the given set of Attributes | setProjectAttributes | {
"repo_name": "rodion-goritskov/test-analytics-ng",
"path": "src/main/java/com/google/testing/testify/risk/frontend/client/view/impl/AttributesViewImpl.java",
"license": "apache-2.0",
"size": 7648
} | [
"com.google.common.collect.Lists",
"com.google.testing.testify.risk.frontend.model.Attribute",
"java.util.List"
] | import com.google.common.collect.Lists; import com.google.testing.testify.risk.frontend.model.Attribute; import java.util.List; | import com.google.common.collect.*; import com.google.testing.testify.risk.frontend.model.*; import java.util.*; | [
"com.google.common",
"com.google.testing",
"java.util"
] | com.google.common; com.google.testing; java.util; | 93,033 |
protected Value eval(Env env, Value qThis,
StringValue methodName, int hashCode,
Expr []argExprs)
{
Value []args = evalArgs(env, argExprs);
env.pushCall(this, qThis, args);
try {
env.checkTimeout();
return qThis.callMethod(env, methodName, hashCode, args);
} finally {
env.popCall();
}
} | Value function(Env env, Value qThis, StringValue methodName, int hashCode, Expr []argExprs) { Value []args = evalArgs(env, argExprs); env.pushCall(this, qThis, args); try { env.checkTimeout(); return qThis.callMethod(env, methodName, hashCode, args); } finally { env.popCall(); } } | /**
* Evaluates the expression.
*
* @param env the calling environment.
*
* @return the expression value.
*/ | Evaluates the expression | eval | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/quercus/expr/AbstractMethodExpr.java",
"license": "gpl-2.0",
"size": 2566
} | [
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.StringValue",
"com.caucho.quercus.env.Value"
] | import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue; import com.caucho.quercus.env.Value; | import com.caucho.quercus.env.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 1,073,163 |
public void testParseClassPathUnix() throws Exception {
assumeTrue("test is designed for unix-like systems only", ":".equals(System.getProperty("path.separator")));
assumeTrue("test is designed for unix-like systems only", "/".equals(System.getProperty("file.separator")));
Path element1 = createTempDir();
Path element2 = createTempDir();
URL expected[] = { element1.toUri().toURL(), element2.toUri().toURL() };
assertArrayEquals(expected, JarHell.parseClassPath(element1.toString() + ":" + element2.toString()));
} | void function() throws Exception { assumeTrue(STR, ":".equals(System.getProperty(STR))); assumeTrue(STR, "/".equals(System.getProperty(STR))); Path element1 = createTempDir(); Path element2 = createTempDir(); URL expected[] = { element1.toUri().toURL(), element2.toUri().toURL() }; assertArrayEquals(expected, JarHell.parseClassPath(element1.toString() + ":" + element2.toString())); } | /**
* Parse a simple classpath with two elements on unix
*/ | Parse a simple classpath with two elements on unix | testParseClassPathUnix | {
"repo_name": "wbowling/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/bootstrap/JarHellTests.java",
"license": "apache-2.0",
"size": 15785
} | [
"java.nio.file.Path"
] | import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 1,355,015 |
public static File createAgentFile( final String p_agentname ) throws IOException
{
if ( ( p_agentname == null ) || ( p_agentname.isEmpty() ) )
throw new IllegalArgumentException( CCommon.getResourceString( IEnvironment.class, "aslempty" ) );
final File l_asl = CConfiguration.getInstance().getLocation( "mas", p_agentname + c_filesuffix );
if ( l_asl.exists() )
throw new IllegalStateException( CCommon.getResourceString( IEnvironment.class, "aslexist" ) );
l_asl.createNewFile();
return l_asl;
} | static File function( final String p_agentname ) throws IOException { if ( ( p_agentname == null ) ( p_agentname.isEmpty() ) ) throw new IllegalArgumentException( CCommon.getResourceString( IEnvironment.class, STR ) ); final File l_asl = CConfiguration.getInstance().getLocation( "mas", p_agentname + c_filesuffix ); if ( l_asl.exists() ) throw new IllegalStateException( CCommon.getResourceString( IEnvironment.class, STR ) ); l_asl.createNewFile(); return l_asl; } | /**
* creates an agent filename on an agent name
*
* @param p_agentname agent name
* @return file object
*
* @throws IOException throws IO exception on file creating error
*/ | creates an agent filename on an agent name | createAgentFile | {
"repo_name": "flashpixx/MecSim",
"path": "src/main/java/de/tu_clausthal/in/mec/object/mas/jason/IEnvironment.java",
"license": "gpl-3.0",
"size": 10960
} | [
"de.tu_clausthal.in.mec.CConfiguration",
"de.tu_clausthal.in.mec.common.CCommon",
"java.io.File",
"java.io.IOException"
] | import de.tu_clausthal.in.mec.CConfiguration; import de.tu_clausthal.in.mec.common.CCommon; import java.io.File; import java.io.IOException; | import de.tu_clausthal.in.mec.*; import de.tu_clausthal.in.mec.common.*; import java.io.*; | [
"de.tu_clausthal.in",
"java.io"
] | de.tu_clausthal.in; java.io; | 2,817,781 |
return LayoutInflater.from(context).inflate(R.layout.list_item, parent, false);
} | return LayoutInflater.from(context).inflate(R.layout.list_item, parent, false); } | /**
* Makes a new blank list item view. No data is set (or bound) to the views yet.
*
* @param context app context
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
* @param parent The parent to which the new view is attached to
* @return the newly created list item view.
*/ | Makes a new blank list item view. No data is set (or bound) to the views yet | newView | {
"repo_name": "tomilina/Pets",
"path": "app/src/main/java/com/example/android/pets/PetCursorAdapter.java",
"license": "apache-2.0",
"size": 2609
} | [
"android.view.LayoutInflater"
] | import android.view.LayoutInflater; | import android.view.*; | [
"android.view"
] | android.view; | 2,555,832 |
@Override
public void loadDataFromFile()
throws InitializationException
{
// Variable declarations
int ObjectLinesLoaded = 0;
BufferedReader inFile;
String tmpFileRecord;
String[] ObjectSplitFields;
int Index;
int tmpFieldCount = 0;
String tmpGroup;
long tmpRangeFrom;
long tmpRangeTo;
long tmpValidityFrom;
long tmpValidityTo;
// Try to open the file
try
{
inFile = new BufferedReader(new FileReader(cacheDataFile));
}
catch (FileNotFoundException ex)
{
message = "Application is not able to read file : <" +
cacheDataFile + ">";
throw new InitializationException(message,ex,getSymbolicName());
}
// File open, now get the stuff
try
{
while (inFile.ready())
{
tmpFileRecord = inFile.readLine();
if ((tmpFileRecord.startsWith("#")) |
tmpFileRecord.trim().equals(""))
{
// Comment line or whitespace line, ignore
}
else
{
ObjectLinesLoaded++;
ObjectSplitFields = tmpFileRecord.split(";");
// Set/Check the field count
if (tmpFieldCount == 0)
{
// set it
tmpFieldCount = ObjectSplitFields.length;
// Check that it is valid - we cannot accept less than 4 fields
if(tmpFieldCount < 4)
{
message = "The data must have >= 4 fields. We got <" + tmpFieldCount +
"> fields in this record <" +
tmpFileRecord + ">";
throw new InitializationException(message,getSymbolicName());
}
}
else
{
// Check that we remain consistent
if (ObjectSplitFields.length != tmpFieldCount)
{
message = "The data must have <" + tmpFieldCount +
"> fields. This record <" +
tmpFileRecord + "> does not conform.";
throw new InitializationException(message,getSymbolicName());
}
}
// parse the input
tmpGroup = ObjectSplitFields[0];
tmpRangeFrom = Long.parseLong(ObjectSplitFields[1]);
tmpRangeTo = Long.parseLong(ObjectSplitFields[2]);
tmpValidityFrom = Long.parseLong(ObjectSplitFields[3]);
tmpValidityTo = Long.parseLong(ObjectSplitFields[4]);
ArrayList<String> tmpResults = new ArrayList<>();
for (Index = 5 ; Index < ObjectSplitFields.length ; Index++)
{
tmpResults.add(ObjectSplitFields[Index]);
}
// Add into the cache
addEntry(tmpGroup,tmpRangeFrom,tmpRangeTo,tmpValidityFrom,tmpValidityTo,tmpResults);
// Update to the log file
if ((ObjectLinesLoaded % loadingLogNotificationStep) == 0)
{
message = "Number Range Data Loading: <" + ObjectLinesLoaded +
"> configurations loaded for <" + getSymbolicName() + "> from <" +
cacheDataFile + ">";
OpenRate.getOpenRateFrameworkLog().info(message);
}
}
}
}
catch (IOException ex)
{
OpenRate.getOpenRateFrameworkLog().fatal(
"Error reading input file <" + cacheDataFile +
"> in record <" + ObjectLinesLoaded + ">. IO Error.");
}
catch (ArrayIndexOutOfBoundsException ex)
{
OpenRate.getOpenRateFrameworkLog().fatal(
"Error reading input file <" + cacheDataFile +
"> in record <" + ObjectLinesLoaded + ">. Malformed Record.");
}
finally
{
try
{
inFile.close();
}
catch (IOException ex)
{
OpenRate.getOpenRateFrameworkLog().error(
"Error closing input file <" + cacheDataFile +
">", ex);
}
}
OpenRate.getOpenRateFrameworkLog().info(
"Number Range Data Loading completed. <" + ObjectLinesLoaded +
"> configuration lines loaded from <" +
cacheDataFile + ">");
} | void function() throws InitializationException { int ObjectLinesLoaded = 0; BufferedReader inFile; String tmpFileRecord; String[] ObjectSplitFields; int Index; int tmpFieldCount = 0; String tmpGroup; long tmpRangeFrom; long tmpRangeTo; long tmpValidityFrom; long tmpValidityTo; try { inFile = new BufferedReader(new FileReader(cacheDataFile)); } catch (FileNotFoundException ex) { message = STR + cacheDataFile + ">"; throw new InitializationException(message,ex,getSymbolicName()); } try { while (inFile.ready()) { tmpFileRecord = inFile.readLine(); if ((tmpFileRecord.startsWith("#")) tmpFileRecord.trim().equals(STR;STRThe data must have >= 4 fields. We got <STR> fields in this record <STR>STRThe data must have <STR> fields. This record <STR> does not conform.STRNumber Range Data Loading: <STR> configurations loaded for <STR> from <STR>STRError reading input file <STR> in record <STR>. IO Error.STRError reading input file <STR> in record <STR>. Malformed Record.STRError closing input file <STR>STRNumber Range Data Loading completed. <STR> configuration lines loaded from <STR>"); } | /**
* Load the data from the defined file
*
* @throws InitializationException
*/ | Load the data from the defined file | loadDataFromFile | {
"repo_name": "isparkes/OpenRate",
"path": "src/main/java/OpenRate/cache/NumberRangeCache.java",
"license": "apache-2.0",
"size": 19807
} | [
"java.io.BufferedReader",
"java.io.FileNotFoundException",
"java.io.FileReader"
] | import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; | import java.io.*; | [
"java.io"
] | java.io; | 2,245,282 |
public static boolean isFileExistInWorkspace(String path) {
if (path == null) {
return false;
}
IFile iFile = getWorksapceFileFromPath(path);
if (iFile == null) {
return false;
}
return iFile.exists();
}
| static boolean function(String path) { if (path == null) { return false; } IFile iFile = getWorksapceFileFromPath(path); if (iFile == null) { return false; } return iFile.exists(); } | /**
* Tests whether the file that represents the specified path exists.
*
* @param path the path.
* @return true if and only if file that represents the specified path exists; false otherwise.
*/ | Tests whether the file that represents the specified path exists | isFileExistInWorkspace | {
"repo_name": "kuriking/testdc2",
"path": "net.dependableos.dcase.diagram.common/src/net/dependableos/dcase/diagram/common/util/FileUtil.java",
"license": "epl-1.0",
"size": 6526
} | [
"org.eclipse.core.resources.IFile"
] | import org.eclipse.core.resources.IFile; | import org.eclipse.core.resources.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 1,457,448 |
public ExecuteIn getExecuteIn(); | ExecuteIn function(); | /**
* The mechanism by which this command is to be executed, either synchronously "in the
* {@link ExecuteIn#FOREGROUND foreground}" or is to be executed asynchronously "in the
* {@link ExecuteIn#BACKGROUND background}" through the {@link BackgroundCommandService}.
*/ | The mechanism by which this command is to be executed, either synchronously "in the <code>ExecuteIn#FOREGROUND foreground</code>" or is to be executed asynchronously "in the <code>ExecuteIn#BACKGROUND background</code>" through the <code>BackgroundCommandService</code> | getExecuteIn | {
"repo_name": "howepeng/isis",
"path": "core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java",
"license": "apache-2.0",
"size": 14121
} | [
"org.apache.isis.applib.annotation.Command"
] | import org.apache.isis.applib.annotation.Command; | import org.apache.isis.applib.annotation.*; | [
"org.apache.isis"
] | org.apache.isis; | 760,328 |
public static Plugin plugin(String groupId, String artifactId) {
return plugin(groupId, artifactId, null);
} | static Plugin function(String groupId, String artifactId) { return plugin(groupId, artifactId, null); } | /**
* Defines the plugin without its version
*
* @param groupId The group id
* @param artifactId The artifact id
* @return The plugin instance
*/ | Defines the plugin without its version | plugin | {
"repo_name": "lotaris/rox-commons-maven-plugin",
"path": "src/main/java/org/twdata/maven/mojoexecutor/MojoExecutor.java",
"license": "mit",
"size": 9298
} | [
"org.apache.maven.model.Plugin"
] | import org.apache.maven.model.Plugin; | import org.apache.maven.model.*; | [
"org.apache.maven"
] | org.apache.maven; | 1,287,999 |
public synchronized Object makeObject(Object key) throws Exception {
Object obj = null;
UserPassKey upkey = (UserPassKey)key;
PooledConnection pc = null;
String username = upkey.getUsername();
String password = upkey.getPassword();
if (username == null) {
pc = _cpds.getPooledConnection();
} else {
pc = _cpds.getPooledConnection(username, password);
}
if (pc == null) {
throw new IllegalStateException("Connection pool data source returned null from getPooledConnection");
}
// should we add this object as a listener or the pool.
// consider the validateObject method in decision
pc.addConnectionEventListener(this);
obj = new PooledConnectionAndInfo(pc, username, password);
pcMap.put(pc, obj);
return obj;
} | synchronized Object function(Object key) throws Exception { Object obj = null; UserPassKey upkey = (UserPassKey)key; PooledConnection pc = null; String username = upkey.getUsername(); String password = upkey.getPassword(); if (username == null) { pc = _cpds.getPooledConnection(); } else { pc = _cpds.getPooledConnection(username, password); } if (pc == null) { throw new IllegalStateException(STR); } pc.addConnectionEventListener(this); obj = new PooledConnectionAndInfo(pc, username, password); pcMap.put(pc, obj); return obj; } | /**
* Creates a new {@link PooledConnectionAndInfo} from the given {@link UserPassKey}.
*
* @param key {@link UserPassKey} containing user credentials
* @throws SQLException if the connection could not be created.
* @see org.apache.tomcat.dbcp.pool.KeyedPoolableObjectFactory#makeObject(java.lang.Object)
*/ | Creates a new <code>PooledConnectionAndInfo</code> from the given <code>UserPassKey</code> | makeObject | {
"repo_name": "xiaolds/tomcat7",
"path": "tomcat-build-libs/tomcat7-deps/dbcp/src/java/org/apache/tomcat/dbcp/dbcp/datasources/KeyedCPDSConnectionFactory.java",
"license": "apache-2.0",
"size": 13221
} | [
"javax.sql.PooledConnection"
] | import javax.sql.PooledConnection; | import javax.sql.*; | [
"javax.sql"
] | javax.sql; | 229,184 |
DateTime getCreateTime(); | DateTime getCreateTime(); | /**
* Return the DateTime the job was created
*
* @return the time the job was created
*/ | Return the DateTime the job was created | getCreateTime | {
"repo_name": "rashidaligee/kylo",
"path": "core/job-repository/job-repository-api/src/main/java/com/thinkbiganalytics/jobrepo/query/model/ExecutedJob.java",
"license": "apache-2.0",
"size": 6391
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 2,243,149 |
private String state(final String host, final int port) throws IOException {
final String stdout = this.script.exec(
host,
new ArrayMap<String, String>().with("port", Integer.toString(port))
);
final String state;
if (stdout.contains("DEAD")) {
state = "dead";
Logger.info(
this, "HTTP port %d at %s doesn't respond",
port, host
);
} else {
state = "alive";
}
return state;
} | String function(final String host, final int port) throws IOException { final String stdout = this.script.exec( host, new ArrayMap<String, String>().with("port", Integer.toString(port)) ); final String state; if (stdout.contains("DEAD")) { state = "dead"; Logger.info( this, STR, port, host ); } else { state = "alive"; } return state; } | /**
* Get state.
* @param host Host name of the tank
* @param port Port to check (HTTP)
* @return State
* @throws IOException If fails
*/ | Get state | state | {
"repo_name": "pecko/thindeck",
"path": "src/main/java/com/thindeck/agents/CheckState.java",
"license": "bsd-3-clause",
"size": 4493
} | [
"com.jcabi.immutable.ArrayMap",
"com.jcabi.log.Logger",
"java.io.IOException"
] | import com.jcabi.immutable.ArrayMap; import com.jcabi.log.Logger; import java.io.IOException; | import com.jcabi.immutable.*; import com.jcabi.log.*; import java.io.*; | [
"com.jcabi.immutable",
"com.jcabi.log",
"java.io"
] | com.jcabi.immutable; com.jcabi.log; java.io; | 877,604 |
void setTool(final ToolParameter tool); | void setTool(final ToolParameter tool); | /**
* Set a new tool for the next set of operations
* This will generate the needed g-code for this machine
*
* @param tool
*/ | Set a new tool for the next set of operations This will generate the needed g-code for this machine | setTool | {
"repo_name": "rvt/cnctools",
"path": "cnctools/src/main/java/com/rvantwisk/cnctools/gcode/CncToolsGCodegenerator.java",
"license": "bsd-3-clause",
"size": 1017
} | [
"com.rvantwisk.cnctools.data.ToolParameter"
] | import com.rvantwisk.cnctools.data.ToolParameter; | import com.rvantwisk.cnctools.data.*; | [
"com.rvantwisk.cnctools"
] | com.rvantwisk.cnctools; | 2,749,361 |
public static ValidatorResult validatePath(String path) {
ValidatorResult result = new ValidatorResult();
if (path == null || path.length() == 0) {
result.addError(new ValidatorError(
"configmanager.filedetails.path.empty", path));
return result;
}
if (!path.startsWith("/")) {
result.addError(new ValidatorError(
"configmanager.filedetails.path.no-starting-slash", path));
}
if (path.endsWith("/")) {
result.addError(new ValidatorError(
"configmanager.filedetails.path.has-ending-slash", path));
}
if (path.indexOf("..") != -1) {
result.addError(new ValidatorError(
"configmanager.filedetails.path.has-relative-dirs", path));
}
return result;
} | static ValidatorResult function(String path) { ValidatorResult result = new ValidatorResult(); if (path == null path.length() == 0) { result.addError(new ValidatorError( STR, path)); return result; } if (!path.startsWith("/")) { result.addError(new ValidatorError( STR, path)); } if (path.endsWith("/")) { result.addError(new ValidatorError( STR, path)); } if (path.indexOf("..") != -1) { result.addError(new ValidatorError( STR, path)); } return result; } | /**
* Validate config-file pathname. The rules are pretty basic:
*
* <ul>
* <li>MUST start with '/'
* <li>CANNOT end with a '/'
* <li>CANNOT be relative - no '..' anywhere
* </ul>
* That's it.
* @param path pathname to be validated
* @return a Validator Result.
*/ | Validate config-file pathname. The rules are pretty basic: MUST start with '/' CANNOT end with a '/' CANNOT be relative - no '..' anywhere That's it | validatePath | {
"repo_name": "shastah/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/configuration/ConfigurationValidation.java",
"license": "gpl-2.0",
"size": 8060
} | [
"com.redhat.rhn.common.validator.ValidatorError",
"com.redhat.rhn.common.validator.ValidatorResult"
] | import com.redhat.rhn.common.validator.ValidatorError; import com.redhat.rhn.common.validator.ValidatorResult; | import com.redhat.rhn.common.validator.*; | [
"com.redhat.rhn"
] | com.redhat.rhn; | 315,071 |
public void setExpiry(Expiry expiry) {
JodaBeanUtils.notNull(expiry, "expiry");
this._expiry = expiry;
} | void function(Expiry expiry) { JodaBeanUtils.notNull(expiry, STR); this._expiry = expiry; } | /**
* Sets the expiry.
* @param expiry the new value of the property, not null
*/ | Sets the expiry | setExpiry | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/option/NonDeliverableFXOptionSecurity.java",
"license": "apache-2.0",
"size": 24557
} | [
"com.opengamma.util.time.Expiry",
"org.joda.beans.JodaBeanUtils"
] | import com.opengamma.util.time.Expiry; import org.joda.beans.JodaBeanUtils; | import com.opengamma.util.time.*; import org.joda.beans.*; | [
"com.opengamma.util",
"org.joda.beans"
] | com.opengamma.util; org.joda.beans; | 1,905,377 |
TransactionMetadata getTransactionMetadata(TxnID txnID) throws PulsarAdminException; | TransactionMetadata getTransactionMetadata(TxnID txnID) throws PulsarAdminException; | /**
* Get transaction metadata.
*
* @param txnID the ID of this transaction
* @return the metadata of this transaction.
*/ | Get transaction metadata | getTransactionMetadata | {
"repo_name": "massakam/pulsar",
"path": "pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java",
"license": "apache-2.0",
"size": 9907
} | [
"org.apache.pulsar.client.api.transaction.TxnID",
"org.apache.pulsar.common.policies.data.TransactionMetadata"
] | import org.apache.pulsar.client.api.transaction.TxnID; import org.apache.pulsar.common.policies.data.TransactionMetadata; | import org.apache.pulsar.client.api.transaction.*; import org.apache.pulsar.common.policies.data.*; | [
"org.apache.pulsar"
] | org.apache.pulsar; | 136,824 |
private void readData(long absolutePosition, ByteBuffer target, int length) {
int remaining = length;
while (remaining > 0) {
dropFragmentsTo(absolutePosition);
int positionInFragment = (int) (absolutePosition - totalBytesDropped);
int toCopy = Math.min(remaining, fragmentLength - positionInFragment);
target.put(dataQueue.peek(), positionInFragment, toCopy);
absolutePosition += toCopy;
remaining -= toCopy;
}
} | void function(long absolutePosition, ByteBuffer target, int length) { int remaining = length; while (remaining > 0) { dropFragmentsTo(absolutePosition); int positionInFragment = (int) (absolutePosition - totalBytesDropped); int toCopy = Math.min(remaining, fragmentLength - positionInFragment); target.put(dataQueue.peek(), positionInFragment, toCopy); absolutePosition += toCopy; remaining -= toCopy; } } | /**
* Reads data from the front of the rolling buffer.
*
* @param absolutePosition The absolute position from which data should be read.
* @param target The buffer into which data should be written.
* @param length The number of bytes to read.
*/ | Reads data from the front of the rolling buffer | readData | {
"repo_name": "Octavianus/Close-Loop-Visual-Stimulus-Display-System",
"path": "library/src/main/java/com/google/android/exoplayer/hls/parser/RollingSampleBuffer.java",
"license": "apache-2.0",
"size": 10702
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,594,967 |
@Beta
public static ExecutorService getExitingExecutorService(
ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) {
return new Application()
.getExitingExecutorService(executor, terminationTimeout, timeUnit);
} | static ExecutorService function( ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) { return new Application() .getExitingExecutorService(executor, terminationTimeout, timeUnit); } | /**
* Converts the given ThreadPoolExecutor into an ExecutorService that exits
* when the application is complete. It does so by using daemon threads and
* adding a shutdown hook to wait for their completion.
*
* <p>This is mainly for fixed thread pools.
* See {@link Executors#newFixedThreadPool(int)}.
*
* @param executor the executor to modify to make sure it exits when the
* application is finished
* @param terminationTimeout how long to wait for the executor to
* finish before terminating the JVM
* @param timeUnit unit of time for the time parameter
* @return an unmodifiable version of the input which will not hang the JVM
*/ | Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application is complete. It does so by using daemon threads and adding a shutdown hook to wait for their completion. This is mainly for fixed thread pools. See <code>Executors#newFixedThreadPool(int)</code> | getExitingExecutorService | {
"repo_name": "wspeirs/sop4j-base",
"path": "src/main/java/com/sop4j/base/google/common/util/concurrent/MoreExecutors.java",
"license": "apache-2.0",
"size": 31275
} | [
"java.util.concurrent.ExecutorService",
"java.util.concurrent.ThreadPoolExecutor",
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 317,533 |
private static void showShareDialog(final Activity activity, final String title,
final String url, final Bitmap screenshot) {
Intent intent = getShareIntent(title, url, null);
PackageManager manager = activity.getPackageManager();
List<ResolveInfo> resolveInfoList = manager.queryIntentActivities(intent, 0);
assert resolveInfoList.size() > 0;
if (resolveInfoList.size() == 0) return;
Collections.sort(resolveInfoList, new ResolveInfo.DisplayNameComparator(manager));
final ShareDialogAdapter adapter =
new ShareDialogAdapter(activity, manager, resolveInfoList);
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.AlertDialogTheme);
builder.setTitle(activity.getString(R.string.share_link_chooser_title));
builder.setAdapter(adapter, null); | static void function(final Activity activity, final String title, final String url, final Bitmap screenshot) { Intent intent = getShareIntent(title, url, null); PackageManager manager = activity.getPackageManager(); List<ResolveInfo> resolveInfoList = manager.queryIntentActivities(intent, 0); assert resolveInfoList.size() > 0; if (resolveInfoList.size() == 0) return; Collections.sort(resolveInfoList, new ResolveInfo.DisplayNameComparator(manager)); final ShareDialogAdapter adapter = new ShareDialogAdapter(activity, manager, resolveInfoList); AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.AlertDialogTheme); builder.setTitle(activity.getString(R.string.share_link_chooser_title)); builder.setAdapter(adapter, null); | /**
* Creates and shows a share intent picker dialog.
*
* @param activity Activity that is used to access package manager.
* @param title Title of the page to be shared.
* @param url URL of the page to be shared.
* @param screenshot Screenshot of the page to be shared.
*/ | Creates and shows a share intent picker dialog | showShareDialog | {
"repo_name": "guorendong/iridium-browser-ubuntu",
"path": "chrome/android/java/src/org/chromium/chrome/browser/share/ShareHelper.java",
"license": "bsd-3-clause",
"size": 12581
} | [
"android.app.Activity",
"android.content.Intent",
"android.content.pm.PackageManager",
"android.content.pm.ResolveInfo",
"android.graphics.Bitmap",
"android.support.v7.app.AlertDialog",
"java.util.Collections",
"java.util.List"
] | import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Bitmap; import android.support.v7.app.AlertDialog; import java.util.Collections; import java.util.List; | import android.app.*; import android.content.*; import android.content.pm.*; import android.graphics.*; import android.support.v7.app.*; import java.util.*; | [
"android.app",
"android.content",
"android.graphics",
"android.support",
"java.util"
] | android.app; android.content; android.graphics; android.support; java.util; | 788,196 |
public void TInterpreterRestoreCursor(){
Cursor cursorBar = new Cursor(Cursor.DEFAULT_CURSOR);
this.setCursor(cursorBar);
}
| void function(){ Cursor cursorBar = new Cursor(Cursor.DEFAULT_CURSOR); this.setCursor(cursorBar); } | /**
* Restore Default Cursor.
*
*/ | Restore Default Cursor | TInterpreterRestoreCursor | {
"repo_name": "hendyyou/FST",
"path": "src/tico/interpreter/TInterpreter.java",
"license": "gpl-3.0",
"size": 14431
} | [
"java.awt.Cursor"
] | import java.awt.Cursor; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,332,427 |
public LineString createLineString(Coordinate[] coordinates) {
if (coordinates == null) {
return new LineString(srid, precision);
}
Coordinate[] clones = new Coordinate[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
clones[i] = (Coordinate) coordinates[i].clone();
}
return new LineString(srid, precision, clones);
} | LineString function(Coordinate[] coordinates) { if (coordinates == null) { return new LineString(srid, precision); } Coordinate[] clones = new Coordinate[coordinates.length]; for (int i = 0; i < coordinates.length; i++) { clones[i] = (Coordinate) coordinates[i].clone(); } return new LineString(srid, precision, clones); } | /**
* Create a new {@link LineString}, given an array of coordinates.
*
* @param coordinates
* An array of {@link Coordinate} objects.
* @return Returns a {@link LineString} object.
*/ | Create a new <code>LineString</code>, given an array of coordinates | createLineString | {
"repo_name": "geomajas/geomajas-project-client-gwt",
"path": "client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java",
"license": "agpl-3.0",
"size": 9524
} | [
"org.geomajas.geometry.Coordinate"
] | import org.geomajas.geometry.Coordinate; | import org.geomajas.geometry.*; | [
"org.geomajas.geometry"
] | org.geomajas.geometry; | 301,986 |
public boolean validateUserGroupSelection(Map<Integer,List<List<Integer>>> groupSelectionMap,List<Integer> selectionList){
boolean retValue=true;
for (int key : groupSelectionMap.keySet()) {
List<List<Integer>> groups = groupSelectionMap.get(key);
for (List<Integer> grp : groups) {
if (selectionList.size() == grp.size()) {
if (!ListUtils.isEqualList(selectionList, grp) && ListUtils.intersection(selectionList, grp).size()==0) {
retValue = true;
}else if(ListUtils.isEqualList(selectionList, grp)){
if (createErrorDialog(Messages.GROUP_CLAUSE_ALREADY_EXISTS).open() == SWT.OK) {
retValue=false;
break;
}
}else if(ListUtils.intersection(selectionList, grp).size() > 0){
if (createErrorDialog(Messages.CANNOT_CREATE_GROUP_CLAUSE).open() == SWT.OK) {
retValue=false;
break;
}
}
}else {
if (ListUtils.isEqualList(ListUtils.intersection(selectionList, grp), grp)) {
retValue = true;
} else if(ListUtils.isEqualList(ListUtils.intersection(grp,selectionList),selectionList)){
retValue=true;
}else if (ListUtils.intersection(selectionList, grp).size() == 0) {
retValue = true;
}else{
if (createErrorDialog(Messages.CANNOT_CREATE_GROUP_CLAUSE).open() == SWT.OK) {
retValue=false;
break;
}
}
}
}
if(!retValue){
break;
}
}
return retValue;
}
| boolean function(Map<Integer,List<List<Integer>>> groupSelectionMap,List<Integer> selectionList){ boolean retValue=true; for (int key : groupSelectionMap.keySet()) { List<List<Integer>> groups = groupSelectionMap.get(key); for (List<Integer> grp : groups) { if (selectionList.size() == grp.size()) { if (!ListUtils.isEqualList(selectionList, grp) && ListUtils.intersection(selectionList, grp).size()==0) { retValue = true; }else if(ListUtils.isEqualList(selectionList, grp)){ if (createErrorDialog(Messages.GROUP_CLAUSE_ALREADY_EXISTS).open() == SWT.OK) { retValue=false; break; } }else if(ListUtils.intersection(selectionList, grp).size() > 0){ if (createErrorDialog(Messages.CANNOT_CREATE_GROUP_CLAUSE).open() == SWT.OK) { retValue=false; break; } } }else { if (ListUtils.isEqualList(ListUtils.intersection(selectionList, grp), grp)) { retValue = true; } else if(ListUtils.isEqualList(ListUtils.intersection(grp,selectionList),selectionList)){ retValue=true; }else if (ListUtils.intersection(selectionList, grp).size() == 0) { retValue = true; }else{ if (createErrorDialog(Messages.CANNOT_CREATE_GROUP_CLAUSE).open() == SWT.OK) { retValue=false; break; } } } } if(!retValue){ break; } } return retValue; } | /**
* Validate user group selection.
*
* @param groupSelectionMap
* the group selection map
* @param selectionList
* the selection list
* @return true, if successful
*/ | Validate user group selection | validateUserGroupSelection | {
"repo_name": "capitalone/Hydrograph",
"path": "hydrograph.ui/hydrograph.ui.dataviewer/src/main/java/hydrograph/ui/dataviewer/filter/FilterHelper.java",
"license": "apache-2.0",
"size": 49299
} | [
"java.util.List",
"java.util.Map",
"org.apache.commons.collections.ListUtils"
] | import java.util.List; import java.util.Map; import org.apache.commons.collections.ListUtils; | import java.util.*; import org.apache.commons.collections.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 2,706,438 |
public void incrementIntent(LocalDateTime ldtEntry, String intentName) {
log.trace("incrementIntent(ldtEntry={}, intentName={}", ldtEntry, intentName);
incrementIntent(ldtEntry, intentName, 1);
} | void function(LocalDateTime ldtEntry, String intentName) { log.trace(STR, ldtEntry, intentName); incrementIntent(ldtEntry, intentName, 1); } | /**
* Increment the IntentLog count by one for the given intentName that occurred
* at ldtEntry time. IntentLog stores counts each intentName occurred
* on a per-week basis.
*
* @param ldtEntry LocalDateTime when the intentName occurred
* @param intentName String of the intent invoked by the user of the application.
*/ | Increment the IntentLog count by one for the given intentName that occurred at ldtEntry time. IntentLog stores counts each intentName occurred on a per-week basis | incrementIntent | {
"repo_name": "jtbaldwin/Alexa-Trash-Day",
"path": "src/main/java/trashday/model/IntentLog.java",
"license": "mit",
"size": 8217
} | [
"java.time.LocalDateTime"
] | import java.time.LocalDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 2,059,026 |
public static IgniteCheckedException cast(Throwable t) {
assert t != null;
while (true) {
if (t instanceof Error)
throw (Error)t;
if (t instanceof GridClosureException) {
t = ((GridClosureException)t).unwrap();
continue;
}
if (t instanceof IgniteCheckedException)
return (IgniteCheckedException)t;
if (!(t instanceof IgniteException) || t.getCause() == null)
return new IgniteCheckedException(t);
assert t.getCause() != null; // ...and it is IgniteException.
t = t.getCause();
}
} | static IgniteCheckedException function(Throwable t) { assert t != null; while (true) { if (t instanceof Error) throw (Error)t; if (t instanceof GridClosureException) { t = ((GridClosureException)t).unwrap(); continue; } if (t instanceof IgniteCheckedException) return (IgniteCheckedException)t; if (!(t instanceof IgniteException) t.getCause() == null) return new IgniteCheckedException(t); assert t.getCause() != null; t = t.getCause(); } } | /**
* Casts this throwable as {@link IgniteCheckedException}. Creates wrapping
* {@link IgniteCheckedException}, if needed.
*
* @param t Throwable to cast.
* @return Grid exception.
*/ | Casts this throwable as <code>IgniteCheckedException</code>. Creates wrapping <code>IgniteCheckedException</code>, if needed | cast | {
"repo_name": "WilliamDo/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 325083
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.IgniteException",
"org.apache.ignite.internal.util.lang.GridClosureException"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.internal.util.lang.GridClosureException; | import org.apache.ignite.*; import org.apache.ignite.internal.util.lang.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,202,724 |
public static Set<Policy> getAvailableImplementationPolicies() {
Set<Policy> implementations = new HashSet<Policy>();
for (Policy p : _policies) {
if (p.supports(PolicyType.IMPLEMENTATION)) {
implementations.add(p);
}
}
return Collections.unmodifiableSet(implementations);
} | static Set<Policy> function() { Set<Policy> implementations = new HashSet<Policy>(); for (Policy p : _policies) { if (p.supports(PolicyType.IMPLEMENTATION)) { implementations.add(p); } } return Collections.unmodifiableSet(implementations); } | /**
* Returns a set of available implementation policies.
* @return policies
*/ | Returns a set of available implementation policies | getAvailableImplementationPolicies | {
"repo_name": "tadayosi/switchyard",
"path": "core/api/src/main/java/org/switchyard/policy/PolicyFactory.java",
"license": "apache-2.0",
"size": 4627
} | [
"java.util.Collections",
"java.util.HashSet",
"java.util.Set",
"org.switchyard.policy.Policy"
] | import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.switchyard.policy.Policy; | import java.util.*; import org.switchyard.policy.*; | [
"java.util",
"org.switchyard.policy"
] | java.util; org.switchyard.policy; | 884,975 |
public CcLibraryHelper addPrivateHeaders(Iterable<Artifact> privateHeaders) {
Iterables.addAll(this.privateHeaders, privateHeaders);
return this;
} | CcLibraryHelper function(Iterable<Artifact> privateHeaders) { Iterables.addAll(this.privateHeaders, privateHeaders); return this; } | /**
* Add the corresponding files as private header files, i.e., these files will not be compiled,
* but are not made visible as includes to dependent rules in module maps.
*/ | Add the corresponding files as private header files, i.e., these files will not be compiled, but are not made visible as includes to dependent rules in module maps | addPrivateHeaders | {
"repo_name": "Topher-the-Geek/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java",
"license": "apache-2.0",
"size": 40433
} | [
"com.google.common.collect.Iterables",
"com.google.devtools.build.lib.actions.Artifact"
] | import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; | import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 1,052,013 |
public void addPoint(String name, Color color, boolean isNameColored, ILocational locational)
{
addPoint(name, color.getRGB(), isNameColored, locational);
}
| void function(String name, Color color, boolean isNameColored, ILocational locational) { addPoint(name, color.getRGB(), isNameColored, locational); } | /**
* Adds a point to be displayed on client.
* @param name the name that will be displayed over the point
* @param color the color
* @param isNameColored if {@code true} name will be colored as well.
* @param locational the ILocational to take coordinates for this point
*/ | Adds a point to be displayed on client | addPoint | {
"repo_name": "rubenswagner/L2J-Global",
"path": "java/com/l2jglobal/gameserver/network/serverpackets/ExServerPrimitive.java",
"license": "gpl-3.0",
"size": 17405
} | [
"com.l2jglobal.gameserver.model.interfaces.ILocational",
"java.awt.Color"
] | import com.l2jglobal.gameserver.model.interfaces.ILocational; import java.awt.Color; | import com.l2jglobal.gameserver.model.interfaces.*; import java.awt.*; | [
"com.l2jglobal.gameserver",
"java.awt"
] | com.l2jglobal.gameserver; java.awt; | 1,906,084 |
protected void hydrateExport(BufferedReader csvFile, Sources sources) throws IOException {
CSVStrategy strategy = new CSVStrategy(',', '"', '#', true, true);
ValueProcessorProvider vpp = new ValueProcessorProvider();
CSVReader<Export> exportReader = new CSVReaderBuilder<Export>(csvFile).strategy(strategy).entryParser(
new AnnotationEntryParser<Export>(Export.class, vpp)).build();
List<Export> export = exportReader.readAll();
List<com.servinglynk.hmis.warehouse.domain.Sources.Source.Export> exportList = new ArrayList<Sources.Source.Export>();
for(Export exp : export){
sources.getSource().getExport().setExportDate(getXMLGregorianCalendar(exp.getExportDate()));
sources.getSource().getExport().setExportDirective(exp.getExportDirective());
sources.getSource().getExport().setExportID(exp.getExportID());
ExportPeriod exportPeriod = new ExportPeriod();
exportPeriod.setEndDate(getXMLGregorianCalendar(exp.getExportEndDate()));
exportPeriod.setStartDate(getXMLGregorianCalendar(exp.getExportStartDate()));
sources.getSource().getExport().setExportPeriodType(exp.getExportPeriodType());
}
}
| void function(BufferedReader csvFile, Sources sources) throws IOException { CSVStrategy strategy = new CSVStrategy(',', '"', '#', true, true); ValueProcessorProvider vpp = new ValueProcessorProvider(); CSVReader<Export> exportReader = new CSVReaderBuilder<Export>(csvFile).strategy(strategy).entryParser( new AnnotationEntryParser<Export>(Export.class, vpp)).build(); List<Export> export = exportReader.readAll(); List<com.servinglynk.hmis.warehouse.domain.Sources.Source.Export> exportList = new ArrayList<Sources.Source.Export>(); for(Export exp : export){ sources.getSource().getExport().setExportDate(getXMLGregorianCalendar(exp.getExportDate())); sources.getSource().getExport().setExportDirective(exp.getExportDirective()); sources.getSource().getExport().setExportID(exp.getExportID()); ExportPeriod exportPeriod = new ExportPeriod(); exportPeriod.setEndDate(getXMLGregorianCalendar(exp.getExportEndDate())); exportPeriod.setStartDate(getXMLGregorianCalendar(exp.getExportStartDate())); sources.getSource().getExport().setExportPeriodType(exp.getExportPeriodType()); } } | /**
* Hydrate Export with in Sources Object from Export CSV Pojos.
* @param csvFile
* @param sources
* @throws IOException
*/ | Hydrate Export with in Sources Object from Export CSV Pojos | hydrateExport | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "hmis-model-v2015/src/main/java/com/servinglynk/hmis/warehouse/dao/helper/BulkUploadHelper.java",
"license": "mpl-2.0",
"size": 73968
} | [
"com.googlecode.jcsv.CSVStrategy",
"com.googlecode.jcsv.annotations.internal.ValueProcessorProvider",
"com.googlecode.jcsv.reader.CSVReader",
"com.googlecode.jcsv.reader.internal.AnnotationEntryParser",
"com.googlecode.jcsv.reader.internal.CSVReaderBuilder",
"com.servinglynk.hmis.warehouse.csv.Export",
... | import com.googlecode.jcsv.CSVStrategy; import com.googlecode.jcsv.annotations.internal.ValueProcessorProvider; import com.googlecode.jcsv.reader.CSVReader; import com.googlecode.jcsv.reader.internal.AnnotationEntryParser; import com.googlecode.jcsv.reader.internal.CSVReaderBuilder; import com.servinglynk.hmis.warehouse.csv.Export; import com.servinglynk.hmis.warehouse.domain.Sources; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; | import com.googlecode.jcsv.*; import com.googlecode.jcsv.annotations.internal.*; import com.googlecode.jcsv.reader.*; import com.googlecode.jcsv.reader.internal.*; import com.servinglynk.hmis.warehouse.csv.*; import com.servinglynk.hmis.warehouse.domain.*; import java.io.*; import java.util.*; | [
"com.googlecode.jcsv",
"com.servinglynk.hmis",
"java.io",
"java.util"
] | com.googlecode.jcsv; com.servinglynk.hmis; java.io; java.util; | 2,688,306 |
@Override
public void validate() throws InvalidValueException {
super.validate();
for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) {
fields.get(i.next()).validate();
}
} | void function() throws InvalidValueException { super.validate(); for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) { fields.get(i.next()).validate(); } } | /**
* Checks the validity of the Form and all of its fields.
*
* @see Validatable#validate()
*/ | Checks the validity of the Form and all of its fields | validate | {
"repo_name": "peterl1084/framework",
"path": "compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java",
"license": "apache-2.0",
"size": 44414
} | [
"com.vaadin.v7.data.Validator",
"java.util.Iterator"
] | import com.vaadin.v7.data.Validator; import java.util.Iterator; | import com.vaadin.v7.data.*; import java.util.*; | [
"com.vaadin.v7",
"java.util"
] | com.vaadin.v7; java.util; | 149,490 |
protected void initUserObject() {
if (m_fieldconfiguration == null) {
try {
m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration());
if (m_fieldconfiguration == null) {
m_fieldconfiguration = new CmsSearchFieldConfiguration();
}
} catch (Exception e) {
m_fieldconfiguration = new CmsSearchFieldConfiguration();
}
}
} | void function() { if (m_fieldconfiguration == null) { try { m_fieldconfiguration = m_searchManager.getFieldConfiguration(getParamFieldconfiguration()); if (m_fieldconfiguration == null) { m_fieldconfiguration = new CmsSearchFieldConfiguration(); } } catch (Exception e) { m_fieldconfiguration = new CmsSearchFieldConfiguration(); } } } | /**
* Initializes the user object to work with depending on the dialog state and request parameters.<p>
*
*/ | Initializes the user object to work with depending on the dialog state and request parameters | initUserObject | {
"repo_name": "serrapos/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/searchindex/A_CmsFieldConfigurationDialog.java",
"license": "lgpl-2.1",
"size": 10646
} | [
"org.opencms.search.fields.CmsSearchFieldConfiguration"
] | import org.opencms.search.fields.CmsSearchFieldConfiguration; | import org.opencms.search.fields.*; | [
"org.opencms.search"
] | org.opencms.search; | 381,912 |
@Override protected double evaluateInstance(
Map<String,Double> goldSenseRatings,
Map<String,Double> testSenseRatings,
int numSenses) {
int inCommon = 0;
for (String sense : goldSenseRatings.keySet()) {
if (testSenseRatings.containsKey(sense))
inCommon++;
}
int unionSize = goldSenseRatings.size() + testSenseRatings.size()
- inCommon;
double jaccardIndex = inCommon / (double)unionSize;
return jaccardIndex;
} | @Override double function( Map<String,Double> goldSenseRatings, Map<String,Double> testSenseRatings, int numSenses) { int inCommon = 0; for (String sense : goldSenseRatings.keySet()) { if (testSenseRatings.containsKey(sense)) inCommon++; } int unionSize = goldSenseRatings.size() + testSenseRatings.size() - inCommon; double jaccardIndex = inCommon / (double)unionSize; return jaccardIndex; } | /**
* Computes the Jaccard Index of the two sense listings
*/ | Computes the Jaccard Index of the two sense listings | evaluateInstance | {
"repo_name": "mpelevina/context-eval",
"path": "semeval_2013_13/cluster-comparison-tools/src/main/java/edu/ucla/clustercomparison/JaccardIndex.java",
"license": "apache-2.0",
"size": 2035
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,190,828 |
void setRoot(EObject value); | void setRoot(EObject value); | /**
* Sets the value of the '{@link org.w3._1999.xlink.DocumentRoot#getRoot <em>Root</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Root</em>' containment reference.
* @see #getRoot()
* @generated
*/ | Sets the value of the '<code>org.w3._1999.xlink.DocumentRoot#getRoot Root</code>' containment reference. | setRoot | {
"repo_name": "GRA-UML/tool",
"path": "plugins/org.ijis.gra.ebxml.cpp-cpa/src/org/w3/_1999/xlink/DocumentRoot.java",
"license": "epl-1.0",
"size": 12676
} | [
"org.eclipse.emf.ecore.EObject"
] | import org.eclipse.emf.ecore.EObject; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,086,938 |
protected void decUsedResource(Resource res) {
synchronized (resourceUsage) {
Resources.subtractFrom(resourceUsage, res);
if (parent != null) {
parent.decUsedResource(res);
}
}
} | void function(Resource res) { synchronized (resourceUsage) { Resources.subtractFrom(resourceUsage, res); if (parent != null) { parent.decUsedResource(res); } } } | /**
* Decrease resource usage for this queue and all parent queues.
*
* @param res the resource to decrease
*/ | Decrease resource usage for this queue and all parent queues | decUsedResource | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java",
"license": "apache-2.0",
"size": 19280
} | [
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.util.resource.Resources"
] | import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.util.resource.Resources; | import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.util.resource.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,052,584 |
@Nullable public static Method getNonPublicMethod(Class<?> cls, String name, Class<?>... paramTypes) {
try {
Method mtd = cls.getDeclaredMethod(name, paramTypes);
mtd.setAccessible(true);
return mtd;
}
catch (NoSuchMethodException ignored) {
// No-op.
}
return null;
} | @Nullable static Method function(Class<?> cls, String name, Class<?>... paramTypes) { try { Method mtd = cls.getDeclaredMethod(name, paramTypes); mtd.setAccessible(true); return mtd; } catch (NoSuchMethodException ignored) { } return null; } | /**
* Gets a method from the class.
*
* Method.getMethod() does not return non-public method.
*
* @param cls Target class.
* @param name Name of the method.
* @param paramTypes Method parameters.
* @return Method or {@code null}.
*/ | Gets a method from the class. Method.getMethod() does not return non-public method | getNonPublicMethod | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 388551
} | [
"java.lang.reflect.Method",
"org.jetbrains.annotations.Nullable"
] | import java.lang.reflect.Method; import org.jetbrains.annotations.Nullable; | import java.lang.reflect.*; import org.jetbrains.annotations.*; | [
"java.lang",
"org.jetbrains.annotations"
] | java.lang; org.jetbrains.annotations; | 1,549,812 |
public void disassociateFromCurves(ConcreteCurve curveToKeep) {
HashSet<ConcreteCurve> copy = new HashSet<ConcreteCurve>();
copy.addAll(getCurves());
for (ConcreteCurve curve : copy) {
// could implement with calling removeFromAllEnclosingCurves and then re-add, but if more things
// happen behind the scences that might have ripple effects.
if (curve != curveToKeep) {
curve.removeEnclosedZone(this);
// removeEnclosingCurve(curve); // no, need to keep the info of what this zone was in
}
}
} | void function(ConcreteCurve curveToKeep) { HashSet<ConcreteCurve> copy = new HashSet<ConcreteCurve>(); copy.addAll(getCurves()); for (ConcreteCurve curve : copy) { if (curve != curveToKeep) { curve.removeEnclosedZone(this); } } } | /**
* Same as removeFromAllEnclosingCurves, but keeps the passed in curve.
* <p/>
* Needed because we often want to remove a curve fom a boundary rectangle, and remove all traces of it from what
* remains in the rectangle, but keep the curve as an image of what it once was.
*
* @param curveToKeep The curve we don't remove
*/ | Same as removeFromAllEnclosingCurves, but keeps the passed in curve. Needed because we often want to remove a curve fom a boundary rectangle, and remove all traces of it from what remains in the rectangle, but keep the curve as an image of what it once was | disassociateFromCurves | {
"repo_name": "MichaelJCompton/ConceptDiagrams",
"path": "src/main/java/org/ontologyengineering/conceptdiagrams/web/shared/concretesyntax/ConcreteZone.java",
"license": "bsd-2-clause",
"size": 10190
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 472,063 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.