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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private void handleBankNotification(Matcher m, String resp) {
if (m == null) {
throw new IllegalArgumentException("m (matcher) cannot be null");
}
// System notification
if (m.groupCount() == 4) {
try {
final int bank = Integer.parseInt(m.group(1));
if (bank != _bank) {
return;
}
final int source = Integer.parseInt(m.group(2));
if (source != _source) {
return;
}
final String key = m.group(3);
final String value = m.group(4);
switch (key) {
case BANK_NAME:
stateChanged(RioConstants.CHANNEL_BANKNAME, new StringType(value));
break;
default:
logger.warn("Unknown bank name notification: '{}'", resp);
break;
}
} catch (NumberFormatException e) {
logger.warn("Invalid Bank Name Notification (bank/source not a parsable integer): '{}')", resp);
}
} else {
logger.warn("Invalid Bank Notification: '{}')", resp);
}
} | void function(Matcher m, String resp) { if (m == null) { throw new IllegalArgumentException(STR); } if (m.groupCount() == 4) { try { final int bank = Integer.parseInt(m.group(1)); if (bank != _bank) { return; } final int source = Integer.parseInt(m.group(2)); if (source != _source) { return; } final String key = m.group(3); final String value = m.group(4); switch (key) { case BANK_NAME: stateChanged(RioConstants.CHANNEL_BANKNAME, new StringType(value)); break; default: logger.warn(STR, resp); break; } } catch (NumberFormatException e) { logger.warn(STR, resp); } } else { logger.warn(STR, resp); } } | /**
* Handles any bank notifications returned by the russound system
*
* @param m a non-null matcher
* @param resp a possibly null, possibly empty response
*/ | Handles any bank notifications returned by the russound system | handleBankNotification | {
"repo_name": "peuter/openhab2-addons",
"path": "addons/binding/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/bank/RioBankProtocol.java",
"license": "epl-1.0",
"size": 4916
} | [
"java.util.regex.Matcher",
"org.eclipse.smarthome.core.library.types.StringType",
"org.openhab.binding.russound.internal.rio.RioConstants"
] | import java.util.regex.Matcher; import org.eclipse.smarthome.core.library.types.StringType; import org.openhab.binding.russound.internal.rio.RioConstants; | import java.util.regex.*; import org.eclipse.smarthome.core.library.types.*; import org.openhab.binding.russound.internal.rio.*; | [
"java.util",
"org.eclipse.smarthome",
"org.openhab.binding"
] | java.util; org.eclipse.smarthome; org.openhab.binding; | 2,262,447 |
public void giveBid(int playerId, Hand newBid, int bidType, int leadPlayer) {
super.giveBid(playerId, newBid, bidType, leadPlayer);
// Invisiblize the cards that were bid from the player's hand
for (int i=0; i<3; i++) {
hands[playerId].invisiblizeCard(newBid.getNthCard(i));
}
} | void function(int playerId, Hand newBid, int bidType, int leadPlayer) { super.giveBid(playerId, newBid, bidType, leadPlayer); for (int i=0; i<3; i++) { hands[playerId].invisiblizeCard(newBid.getNthCard(i)); } } | /**
* Provide a new bid for a player.
* Overriding this method from CoreModel so that we can remove the
* bid cards from the player's hand.
*
* @param playerId The player whose bid is being given
* @param newBid The new bid hand for the player
* @param bidType The type of bid
* @param leadPlayer The player who should lead, in case of a Reveal bid
*/ | Provide a new bid for a player. Overriding this method from CoreModel so that we can remove the bid cards from the player's hand | giveBid | {
"repo_name": "lsilvestre/Jogre",
"path": "games/ninetynine/src/org/jogre/ninetynine/server/NinetyNineServerModel.java",
"license": "gpl-2.0",
"size": 3807
} | [
"org.jogre.ninetynine.std.Hand"
] | import org.jogre.ninetynine.std.Hand; | import org.jogre.ninetynine.std.*; | [
"org.jogre.ninetynine"
] | org.jogre.ninetynine; | 1,297,144 |
public void close() throws SQLException {
synchronized (this) {
if (XAResource != null) {
XAResource.close();
XAResource = null;
}
if (null != physicalControlConnection) {
physicalControlConnection.close();
physicalControlConnection = null;
}
}
super.close();
} | void function() throws SQLException { synchronized (this) { if (XAResource != null) { XAResource.close(); XAResource = null; } if (null != physicalControlConnection) { physicalControlConnection.close(); physicalControlConnection = null; } } super.close(); } | /**
* Closes the physical connection that this PooledConnection object represents.
*/ | Closes the physical connection that this PooledConnection object represents | close | {
"repo_name": "v-nisidh/mssql-jdbc",
"path": "src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAConnection.java",
"license": "mit",
"size": 3632
} | [
"java.sql.SQLException",
"javax.transaction.xa.XAResource"
] | import java.sql.SQLException; import javax.transaction.xa.XAResource; | import java.sql.*; import javax.transaction.xa.*; | [
"java.sql",
"javax.transaction"
] | java.sql; javax.transaction; | 979,744 |
public static void demo1() throws ExecutionException, InterruptedException, IOException {
CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
try {
httpclient.start();
HttpGet request = new HttpGet("http://httpbin.org/get");
Future<HttpResponse> future = httpclient.execute(request, null);
HttpResponse response = future.get();
System.out.println("Response: " + response.getStatusLine());
System.out.println(EntityUtils.toString(response.getEntity()));
System.out.println("Shutting down");
} finally {
httpclient.close();
}
System.out.println("Done");
} | static void function() throws ExecutionException, InterruptedException, IOException { CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); try { httpclient.start(); HttpGet request = new HttpGet(STRResponse: STRShutting downSTRDone"); } | /**
* This example demonstrates a basic asynchronous HTTP request / response exchange. Response content is buffered in memory for simplicity.
*/ | This example demonstrates a basic asynchronous HTTP request / response exchange. Response content is buffered in memory for simplicity | demo1 | {
"repo_name": "dydeve/web",
"path": "rest/src/main/java/dydeve/rest/demo/AsyncClient.java",
"license": "apache-2.0",
"size": 10812
} | [
"java.io.IOException",
"java.util.concurrent.ExecutionException",
"org.apache.http.client.methods.HttpGet",
"org.apache.http.impl.nio.client.CloseableHttpAsyncClient",
"org.apache.http.impl.nio.client.HttpAsyncClients"
] | import java.io.IOException; import java.util.concurrent.ExecutionException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; import org.apache.http.impl.nio.client.HttpAsyncClients; | import java.io.*; import java.util.concurrent.*; import org.apache.http.client.methods.*; import org.apache.http.impl.nio.client.*; | [
"java.io",
"java.util",
"org.apache.http"
] | java.io; java.util; org.apache.http; | 2,905,327 |
protected void addResultPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_EOperationInvocation_result_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_EOperationInvocation_result_feature",
"_UI_EOperationInvocation_type"),
ECPPackage.Literals.EOPERATION_INVOCATION__RESULT, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
} | void function(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), ECPPackage.Literals.EOPERATION_INVOCATION__RESULT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Result feature. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @generated
*/ | This adds a property descriptor for the Result feature. | addResultPropertyDescriptor | {
"repo_name": "enterpriseDomain/ClassMaker",
"path": "bundles/org.enterprisedomain.ecp.edit/src/org/enterprisedomain/ecp/provider/EOperationInvocationItemProvider.java",
"license": "apache-2.0",
"size": 6957
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.enterprisedomain.ecp.ECPPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.enterprisedomain.ecp.ECPPackage; | import org.eclipse.emf.edit.provider.*; import org.enterprisedomain.ecp.*; | [
"org.eclipse.emf",
"org.enterprisedomain.ecp"
] | org.eclipse.emf; org.enterprisedomain.ecp; | 1,916,453 |
public byte[] getTile( String tableName, int tx, int ty, int zoom ) throws Exception {
// if (tileRowType.equals("tms")) { // if it is not OSM way
// int[] tmsTileXY = MercatorUtils.osmTile2TmsTile(tx, ty, zoom);
// ty = tmsTileXY[1];
// }
String sql = format(SELECTQUERY, DbsUtilities.fixTableName(tableName));
return sqliteDb.execOnConnection(connection -> {
byte[] imageBytes = null;
try (IHMPreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, zoom);
statement.setInt(2, tx);
statement.setInt(3, ty);
IHMResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
imageBytes = resultSet.getBytes(1);
}
}
return imageBytes;
});
} | byte[] function( String tableName, int tx, int ty, int zoom ) throws Exception { String sql = format(SELECTQUERY, DbsUtilities.fixTableName(tableName)); return sqliteDb.execOnConnection(connection -> { byte[] imageBytes = null; try (IHMPreparedStatement statement = connection.prepareStatement(sql)) { statement.setInt(1, zoom); statement.setInt(2, tx); statement.setInt(3, ty); IHMResultSet resultSet = statement.executeQuery(); if (resultSet.next()) { imageBytes = resultSet.getBytes(1); } } return imageBytes; }); } | /**
* Get a Tile's image bytes from the database for a given table.
*
* @param tableName the table name to get the image from.
* @param tx the x tile index.
* @param ty the y tile index, the osm way.
* @param zoom the zoom level.
* @return the tile image bytes.
* @throws Exception
*/ | Get a Tile's image bytes from the database for a given table | getTile | {
"repo_name": "moovida/jgrasstools",
"path": "dbs/src/main/java/org/hortonmachine/dbs/geopackage/GeopackageCommonDb.java",
"license": "gpl-3.0",
"size": 69232
} | [
"java.lang.String",
"org.hortonmachine.dbs.compat.IHMPreparedStatement",
"org.hortonmachine.dbs.compat.IHMResultSet",
"org.hortonmachine.dbs.utils.DbsUtilities"
] | import java.lang.String; import org.hortonmachine.dbs.compat.IHMPreparedStatement; import org.hortonmachine.dbs.compat.IHMResultSet; import org.hortonmachine.dbs.utils.DbsUtilities; | import java.lang.*; import org.hortonmachine.dbs.compat.*; import org.hortonmachine.dbs.utils.*; | [
"java.lang",
"org.hortonmachine.dbs"
] | java.lang; org.hortonmachine.dbs; | 3,470 |
@Override
public void mouseEntered(MouseEvent e) { } | public void mouseEntered(MouseEvent e) { } | /**
* This method cannot be called directly.
*/ | This method cannot be called directly | mouseClicked | {
"repo_name": "gjgj821/fortress",
"path": "src/main/java/stdlib/StdDraw.java",
"license": "mit",
"size": 70938
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,184,497 |
public static boolean compare(InputStream refStream,
InputStream newStream)
throws IOException{
int b, nb;
do {
b = refStream.read();
nb = newStream.read();
} while (b != -1 && nb != -1 && b == nb);
refStream.close();
newStream.close();
return (b == nb);
} | static boolean function(InputStream refStream, InputStream newStream) throws IOException{ int b, nb; do { b = refStream.read(); nb = newStream.read(); } while (b != -1 && nb != -1 && b == nb); refStream.close(); newStream.close(); return (b == nb); } | /**
* Compare the two input streams
*/ | Compare the two input streams | compare | {
"repo_name": "Squeegee/batik",
"path": "test-sources/org/apache/batik/test/util/ImageCompareTest.java",
"license": "apache-2.0",
"size": 12556
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,706,872 |
@Override
public int createApplication(ServiceProvider serviceProvider, String tenantDomain)
throws IdentityApplicationManagementException {
// get logged-in users tenant identifier.
int tenantID = MultitenantConstants.INVALID_TENANT_ID;
if (tenantDomain != null) {
tenantID = IdentityTenantUtil.getTenantId(tenantDomain);
}
String qualifiedUsername = CarbonContext.getThreadLocalCarbonContext().getUsername();
if (ApplicationConstants.LOCAL_SP.equals(serviceProvider.getApplicationName())) {
qualifiedUsername = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
}
String username = UserCoreUtil.removeDomainFromName(qualifiedUsername);
String userStoreDomain = IdentityUtil.extractDomainFromName(qualifiedUsername);
String applicationName = serviceProvider.getApplicationName();
String description = serviceProvider.getDescription();
if (log.isDebugEnabled()) {
log.debug("Creating Application " + applicationName + " for user " + qualifiedUsername);
}
Connection connection = IdentityDatabaseUtil.getDBConnection();
PreparedStatement storeAppPrepStmt = null;
ResultSet results = null;
try {
String dbProductName = connection.getMetaData().getDatabaseProductName();
storeAppPrepStmt = connection.prepareStatement(
ApplicationMgtDBQueries.STORE_BASIC_APPINFO, new String[]{
DBUtils.getConvertedAutoGeneratedColumnName(dbProductName, "ID")});
// TENANT_ID, APP_NAME, USER_STORE, USERNAME, DESCRIPTION, AUTH_TYPE
storeAppPrepStmt.setInt(1, tenantID);
storeAppPrepStmt.setString(2, applicationName);
storeAppPrepStmt.setString(3, userStoreDomain);
storeAppPrepStmt.setString(4, username);
storeAppPrepStmt.setString(5, description);
// by default authentication type would be default.
// default authenticator is defined system-wide - in the configuration file.
storeAppPrepStmt.setString(6, ApplicationConstants.AUTH_TYPE_DEFAULT);
storeAppPrepStmt.setString(7, "0");
storeAppPrepStmt.setString(8, "0");
storeAppPrepStmt.setString(9, "0");
storeAppPrepStmt.execute();
results = storeAppPrepStmt.getGeneratedKeys();
int applicationId = 0;
if (results.next()) {
applicationId = results.getInt(1);
}
// some JDBC Drivers returns this in the result, some don't
if (applicationId == 0) {
if (log.isDebugEnabled()) {
log.debug("JDBC Driver did not return the application id, executing Select operation");
}
applicationId = getApplicationIDByName(applicationName, tenantID, connection);
}
if (serviceProvider.getSpProperties() != null) {
addServiceProviderProperties(connection, applicationId,
Arrays.asList(serviceProvider.getSpProperties()), tenantID);
}
if (!connection.getAutoCommit()) {
connection.commit();
}
if (log.isDebugEnabled()) {
log.debug("Application Stored successfully with application id " + applicationId);
}
return applicationId;
} catch (SQLException e) {
try {
if (connection != null) {
connection.rollback();
}
} catch (SQLException sql) {
throw new IdentityApplicationManagementException(
"Error while Creating Application", sql);
}
throw new IdentityApplicationManagementException("Error while Creating Application", e);
} finally {
IdentityApplicationManagementUtil.closeResultSet(results);
IdentityApplicationManagementUtil.closeStatement(storeAppPrepStmt);
IdentityApplicationManagementUtil.closeConnection(connection);
}
} | int function(ServiceProvider serviceProvider, String tenantDomain) throws IdentityApplicationManagementException { int tenantID = MultitenantConstants.INVALID_TENANT_ID; if (tenantDomain != null) { tenantID = IdentityTenantUtil.getTenantId(tenantDomain); } String qualifiedUsername = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (ApplicationConstants.LOCAL_SP.equals(serviceProvider.getApplicationName())) { qualifiedUsername = CarbonConstants.REGISTRY_SYSTEM_USERNAME; } String username = UserCoreUtil.removeDomainFromName(qualifiedUsername); String userStoreDomain = IdentityUtil.extractDomainFromName(qualifiedUsername); String applicationName = serviceProvider.getApplicationName(); String description = serviceProvider.getDescription(); if (log.isDebugEnabled()) { log.debug(STR + applicationName + STR + qualifiedUsername); } Connection connection = IdentityDatabaseUtil.getDBConnection(); PreparedStatement storeAppPrepStmt = null; ResultSet results = null; try { String dbProductName = connection.getMetaData().getDatabaseProductName(); storeAppPrepStmt = connection.prepareStatement( ApplicationMgtDBQueries.STORE_BASIC_APPINFO, new String[]{ DBUtils.getConvertedAutoGeneratedColumnName(dbProductName, "ID")}); storeAppPrepStmt.setInt(1, tenantID); storeAppPrepStmt.setString(2, applicationName); storeAppPrepStmt.setString(3, userStoreDomain); storeAppPrepStmt.setString(4, username); storeAppPrepStmt.setString(5, description); storeAppPrepStmt.setString(6, ApplicationConstants.AUTH_TYPE_DEFAULT); storeAppPrepStmt.setString(7, "0"); storeAppPrepStmt.setString(8, "0"); storeAppPrepStmt.setString(9, "0"); storeAppPrepStmt.execute(); results = storeAppPrepStmt.getGeneratedKeys(); int applicationId = 0; if (results.next()) { applicationId = results.getInt(1); } if (applicationId == 0) { if (log.isDebugEnabled()) { log.debug(STR); } applicationId = getApplicationIDByName(applicationName, tenantID, connection); } if (serviceProvider.getSpProperties() != null) { addServiceProviderProperties(connection, applicationId, Arrays.asList(serviceProvider.getSpProperties()), tenantID); } if (!connection.getAutoCommit()) { connection.commit(); } if (log.isDebugEnabled()) { log.debug(STR + applicationId); } return applicationId; } catch (SQLException e) { try { if (connection != null) { connection.rollback(); } } catch (SQLException sql) { throw new IdentityApplicationManagementException( STR, sql); } throw new IdentityApplicationManagementException(STR, e); } finally { IdentityApplicationManagementUtil.closeResultSet(results); IdentityApplicationManagementUtil.closeStatement(storeAppPrepStmt); IdentityApplicationManagementUtil.closeConnection(connection); } } | /**
* Stores basic application information and meta-data such as the application name, creator and
* tenant.
*
* @param serviceProvider
* @throws IdentityApplicationManagementException
*/ | Stores basic application information and meta-data such as the application name, creator and tenant | createApplication | {
"repo_name": "nuwandi-is/identity-framework",
"path": "components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java",
"license": "apache-2.0",
"size": 141804
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.Arrays",
"org.wso2.carbon.CarbonConstants",
"org.wso2.carbon.context.CarbonContext",
"org.wso2.carbon.identity.application.common.IdentityApplicationManagementException",
"org.wso2.carbon.identity.application.common.model.ServiceProvider",
"org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil",
"org.wso2.carbon.identity.application.mgt.ApplicationConstants",
"org.wso2.carbon.identity.application.mgt.ApplicationMgtDBQueries",
"org.wso2.carbon.identity.core.util.IdentityDatabaseUtil",
"org.wso2.carbon.identity.core.util.IdentityTenantUtil",
"org.wso2.carbon.identity.core.util.IdentityUtil",
"org.wso2.carbon.user.core.util.UserCoreUtil",
"org.wso2.carbon.utils.DBUtils",
"org.wso2.carbon.utils.multitenancy.MultitenantConstants"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; import org.wso2.carbon.identity.application.common.model.ServiceProvider; import org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil; import org.wso2.carbon.identity.application.mgt.ApplicationConstants; import org.wso2.carbon.identity.application.mgt.ApplicationMgtDBQueries; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.user.core.util.UserCoreUtil; import org.wso2.carbon.utils.DBUtils; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; | import java.sql.*; import java.util.*; import org.wso2.carbon.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.application.common.*; import org.wso2.carbon.identity.application.common.model.*; import org.wso2.carbon.identity.application.common.util.*; import org.wso2.carbon.identity.application.mgt.*; import org.wso2.carbon.identity.core.util.*; import org.wso2.carbon.user.core.util.*; import org.wso2.carbon.utils.*; import org.wso2.carbon.utils.multitenancy.*; | [
"java.sql",
"java.util",
"org.wso2.carbon"
] | java.sql; java.util; org.wso2.carbon; | 2,617,909 |
protected static ClientConfiguration getClientConfiguration(JobConf job) {
return InputConfigurator.getClientConfiguration(CLASS, job);
} | static ClientConfiguration function(JobConf job) { return InputConfigurator.getClientConfiguration(CLASS, job); } | /**
* Fetch the client configuration from the job.
*
* @param job
* The job
* @return The client configuration for the job
* @since 1.7.0
*/ | Fetch the client configuration from the job | getClientConfiguration | {
"repo_name": "adamjshook/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java",
"license": "apache-2.0",
"size": 31041
} | [
"org.apache.accumulo.core.client.ClientConfiguration",
"org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator",
"org.apache.hadoop.mapred.JobConf"
] | import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator; import org.apache.hadoop.mapred.JobConf; | import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.client.mapreduce.lib.impl.*; import org.apache.hadoop.mapred.*; | [
"org.apache.accumulo",
"org.apache.hadoop"
] | org.apache.accumulo; org.apache.hadoop; | 1,347,178 |
// Spout Start - Most of function rewritten
// TODO: Rewrite again, it's in a horrible state, I'm surprised it works...
public void renderGameOverlay(float f, boolean flag, int i, int j) {
InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen();
ScaledResolution scaledRes = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
int screenWidth = scaledRes.getScaledWidth();
int screenHeight = scaledRes.getScaledHeight();
FontRenderer font = this.mc.fontRenderer;
this.mc.entityRenderer.setupOverlayRendering();
GL11.glEnable(GL11.GL_BLEND);
if (Minecraft.isFancyGraphicsEnabled()) {
this.renderVignette(this.mc.thePlayer.getBrightness(f), screenWidth, screenHeight);
} else {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
ItemStack helmet = this.mc.thePlayer.inventory.armorItemInSlot(3);
if (this.mc.gameSettings.thirdPersonView == 0 && helmet != null && helmet.itemID == Block.pumpkin.blockID) {
this.renderPumpkinBlur(screenWidth, screenHeight);
}
if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) {
float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * f;
if (var10 > 0.0F) {
this.func_130015_b(var10, screenWidth, screenHeight); //renderPortalOverlay
}
}
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(widgetsTexPath);
InventoryPlayer var11 = this.mc.thePlayer.inventory;
this.zLevel = -90.0F;
this.drawTexturedModalRect(screenWidth / 2 - 91, screenHeight - 22, 0, 0, 182, 22);
this.drawTexturedModalRect(screenWidth / 2 - 91 - 1 + var11.currentItem * 20, screenHeight - 22 - 1, 0, 22, 24, 22);
this.mc.getTextureManager().bindTexture(icons);
GL11.glEnable(3042 );
GL11.glBlendFunc(775, 769);
this.drawTexturedModalRect(screenWidth / 2 - 7, screenHeight / 2 - 7, 0, 0, 16, 16);
GL11.glDisable(3042 );
GuiIngame.rand.setSeed((long) (this.updateCounter * 312871));
int var15;
int var17;
this.renderBossHealth();
// Toggle visibility if needed
if (needsUpdate && mainScreen.getHealthBar().isVisible() == mc.playerController.isInCreativeMode()) {
mainScreen.toggleSurvivalHUD(!mc.playerController.isInCreativeMode());
}
needsUpdate = false;
// Hunger Bar Begin
mainScreen.getHungerBar().render();
// Hunger Bar End
// Armor Bar Begin
mainScreen.getArmorBar().render();
// Armor Bar End
// Health Bar Begin
mainScreen.getHealthBar().render();
// Health Bar End
// Bubble Bar Begin
mainScreen.getBubbleBar().render();
// Bubble Bar End
// Exp Bar Begin
mainScreen.getExpBar().render();
// Exp Bar End
map.onRenderTick();
GL11.glDisable(GL11.GL_BLEND);
this.mc.mcProfiler.startSection("actionBar");
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
for (var15 = 0; var15 < 9; ++var15) {
int x = screenWidth / 2 - 90 + var15 * 20 + 2;
var17 = screenHeight - 16 - 3;
this.renderInventorySlot(var15, x, var17, f);
}
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
this.mc.mcProfiler.endSection();
if (this.mc.thePlayer.getSleepTimer() > 0) {
GL11.glDisable(2929 );
GL11.glDisable(3008 );
var15 = this.mc.thePlayer.getSleepTimer();
float var26 = (float)var15 / 100.0F;
if (var26 > 1.0F) {
var26 = 1.0F - (float)(var15 - 100) / 10.0F;
}
var17 = (int)(220.0F * var26) << 24 | 1052704;
this.drawRect(0, 0, screenWidth, screenHeight, var17);
GL11.glEnable(3008 );
GL11.glEnable(2929 );
}
mainScreen.render();
int var111;
var111 = screenWidth / 2 - 91;
int var12;
int var13;
int var14;
int var115;
int var117;
int var16;
float var33;
float var313;
short var317;
//ToDo: this will need TLC
if (this.mc.thePlayer.isRidingHorse()) {
this.mc.mcProfiler.startSection("jumpBar");
this.mc.getTextureManager().bindTexture(Gui.icons);
var313 = this.mc.thePlayer.getHorseJumpPower();
var317 = 182;
var14 = (int)(var313 * (float)(var317 + 1));
var115 = screenHeight - 32 + 3;
this.drawTexturedModalRect(var111, var115, 0, 84, var317, 5);
if (var14 > 0) {
this.drawTexturedModalRect(var111, var115, 0, 89, var14, 5);
}
this.mc.mcProfiler.endSection();
} else if (this.mc.playerController.func_78763_f()) {
// Spout -> Removed, we have our own.
}
if (this.mc.gameSettings.showDebugInfo) {
this.mc.mcProfiler.startSection("debug");
GL11.glPushMatrix();
if (Configuration.getFastDebug() != 2) {
font.drawStringWithShadow("Spoutcraft 1.6.4 (" + this.mc.debug + ")", 2, 2, 16777215);
font.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
font.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
font.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
font.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
long var41 = Runtime.getRuntime().maxMemory();
long var34 = Runtime.getRuntime().totalMemory();
long var42 = Runtime.getRuntime().freeMemory();
long var43 = var34 - var42;
String var45 = "Used memory: " + var43 * 100L / var41 + "% (" + var43 / 1024L / 1024L + "MB) of " + var41 / 1024L / 1024L + "MB";
this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 2, 14737632);
var45 = "Allocated memory: " + var34 * 100L / var41 + "% (" + var34 / 1024L / 1024L + "MB)";
this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 12, 14737632);
int var47 = MathHelper.floor_double(this.mc.thePlayer.posX);
int var22 = MathHelper.floor_double(this.mc.thePlayer.posY);
int var23 = MathHelper.floor_double(this.mc.thePlayer.posZ);
if(SpoutClient.getInstance().isCoordsCheat()) {
this.drawString(font, String.format("x: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posX), Integer.valueOf(var47), Integer.valueOf(var47 >> 4), Integer.valueOf(var47 & 15)}), 2, 64, 14737632);
this.drawString(font, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632);
this.drawString(font, String.format("z: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posZ), Integer.valueOf(var23), Integer.valueOf(var23 >> 4), Integer.valueOf(var23 & 15)}), 2, 80, 14737632);
int var24 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
this.drawString(font, "f: " + var24 + " (" + Direction.directions[var24] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632);
}
if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var47, var22, var23)) {
Chunk var48 = this.mc.theWorld.getChunkFromBlockCoords(var47, var23);
this.drawString(font, "lc: " + (var48.getTopFilledSegment() + 15) + " b: " + var48.getBiomeGenForWorldCoords(var47 & 15, var23 & 15, this.mc.theWorld.getWorldChunkManager()).biomeName + " bl: " + var48.getSavedLightValue(EnumSkyBlock.Block, var47 & 15, var22, var23 & 15) + " sl: " + var48.getSavedLightValue(EnumSkyBlock.Sky, var47 & 15, var22, var23 & 15) + " rl: " + var48.getBlockLightValue(var47 & 15, var22, var23 & 15, 0), 2, 96, 14737632);
}
this.drawString(font, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] {Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()), Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23))}), 2, 104, 14737632);
} else {
font.drawStringWithShadow(Integer.toString(Minecraft.framesPerSecond), 4, 2, 0xFFE303);
}
this.mc.mcProfiler.endSection();
GL11.glPopMatrix();
if (this.recordPlayingUpFor > 0) {
this.mc.mcProfiler.startSection("overlayMessage");
var33 = (float)this.recordPlayingUpFor - f;
var12 = (int)(var33 * 256.0F / 20.0F);
if (var12 > 255) {
var12 = 255;
}
if (var12 > 0) {
GL11.glPushMatrix();
GL11.glTranslatef((float)(screenWidth / 2), (float)(screenHeight - 48), 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
var13 = 16777215;
if (this.recordIsPlaying) {
var13 = Color.HSBtoRGB(var33 / 50.0F, 0.7F, 0.6F) & 16777215;
}
font.drawString(this.recordPlaying, -font.getStringWidth(this.recordPlaying) / 2, -4, var13 + (var12 << 24));
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
this.mc.mcProfiler.endSection();
}
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
int var38;
// Spout Start
float pHealth;
float ppHealth;
// Hotbar Text
if (Configuration.showHotbarText) {
String var35;
String custom = null;
pHealth = this.mc.thePlayer.getHealth();
ppHealth = this.mc.thePlayer.prevHealth;
String var34 = "" + this.mc.thePlayer.experienceLevel;
var38 = (screenWidth - font.getStringWidth(var34)) / 2;
this.mc.mcProfiler.startSection("toolHighlight");
if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) {
if (this.highlightingItemStack.itemID == MaterialData.flint.getRawId()) {
custom = Spoutcraft.getMaterialManager().getToolTip(new CraftItemStack(this.highlightingItemStack));
}
if (custom != null) {
String[] split = custom.split("\n");
String newCustom = split[0];
var35 = newCustom;
} else {
var35 = this.highlightingItemStack.getDisplayName();
}
var12 = (screenWidth - font.getStringWidth(var35)) / 2;
var13 = screenHeight - 59;
if (!mainScreen.getHungerBar().isVisible() || !mainScreen.getHealthBar().isVisible()) {
var13 += 8;
}
if (!mainScreen.getArmorBar().isVisible()) {
var13 += 8;
}
if (!mainScreen.getExpBar().isVisible()) {
var13 += 6;
}
var38 = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);
if (var38 > 255) {
var38 = 255;
}
if (var38 > 0) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
font.drawStringWithShadow(var35, var12, var13, 16777215 + (var38 << 24));
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
this.mc.mcProfiler.endSection();
}
ScoreObjective var42 = this.mc.theWorld.getScoreboard().func_96539_a(1);
if (var42 != null) {
this.func_96136_a(var42, screenHeight, screenWidth, font);
}
GL11.glTranslatef(0.0F, (float)(screenHeight - 48), 0.0F);
this.mc.mcProfiler.startSection("chat");
this.persistantChatGUI.drawChat(this.updateCounter);
this.mc.mcProfiler.endSection();
GL11.glPopMatrix();
var42 = this.mc.theWorld.getScoreboard().func_96539_a(0);
if (this.mc.gameSettings.keyBindPlayerList.pressed && (!this.mc.isIntegratedServerRunning() || this.mc.thePlayer.sendQueue.playerInfoList.size() > 1)) {
this.mc.mcProfiler.startSection("playerList");
NetClientHandler var37 = this.mc.thePlayer.sendQueue;
List var39 = var37.playerInfoList;
var13 = var37.currentServerMaxPlayers;
int var40 = var13;
for (var38 = 1; var40 > 20; var40 = (var13 + var38 - 1) / var38) {
++var38;
}
var16 = 300 / var38;
if (var16 > 150) {
var16 = 150;
}
var117 = (screenWidth - var38 * var16) / 2;
byte var44 = 10;
drawRect(var117 - 1, var44 - 1, var117 + var16 * var38, var44 + 9 * var40, Integer.MIN_VALUE);
for (int var19 = 0; var19 < var13; ++var19) {
int var20 = var117 + var19 % var38 * var16;
int var47 = var44 + var19 / var38 * 9;
drawRect(var20, var47, var20 + var16 - 1, var47 + 8, 553648127);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_ALPHA_TEST);
if (var19 < var39.size()) {
GuiPlayerInfo var46 = (GuiPlayerInfo)var39.get(var19);
ScorePlayerTeam var60 = this.mc.theWorld.getScoreboard().getPlayersTeam(var46.name);
String var53 = ScorePlayerTeam.formatPlayerName(var60, var46.name);
font.drawStringWithShadow(var53, var20, var47, 16777215);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // TODO: might not need this.
if (var42 != null) {
int var51 = var20 + font.getStringWidth(var53) + 5;
int var50 = var20 + var16 - 12 - 5;
if (var50 - var51 > 5) {
Score var56 = var42.getScoreboard().func_96529_a(var46.name, var42);
String var57 = EnumChatFormatting.YELLOW + "" + var56.getScorePoints();
font.drawStringWithShadow(var57, var50 - font.getStringWidth(var57), var47, 16777215);
}
}
this.mc.getTextureManager().bindTexture(icons);
byte var50 = 0;
boolean var48 = false;
byte var49;
if (var46.responseTime < 0) {
var49 = 5;
} else if (var46.responseTime < 150) {
var49 = 0;
} else if (var46.responseTime < 300) {
var49 = 1;
} else if (var46.responseTime < 600) {
var49 = 2;
} else if (var46.responseTime < 1000) {
var49 = 3;
} else {
var49 = 4;
}
this.zLevel += 100.0F;
this.drawTexturedModalRect(var20 + var16 - 12, var47, 0 + var50 * 10, 176 + var49 * 8, 10, 8);
this.zLevel -= 100.0F;
}
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
} | void function(float f, boolean flag, int i, int j) { InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen(); ScaledResolution scaledRes = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); int screenWidth = scaledRes.getScaledWidth(); int screenHeight = scaledRes.getScaledHeight(); FontRenderer font = this.mc.fontRenderer; this.mc.entityRenderer.setupOverlayRendering(); GL11.glEnable(GL11.GL_BLEND); if (Minecraft.isFancyGraphicsEnabled()) { this.renderVignette(this.mc.thePlayer.getBrightness(f), screenWidth, screenHeight); } else { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } ItemStack helmet = this.mc.thePlayer.inventory.armorItemInSlot(3); if (this.mc.gameSettings.thirdPersonView == 0 && helmet != null && helmet.itemID == Block.pumpkin.blockID) { this.renderPumpkinBlur(screenWidth, screenHeight); } if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) { float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * f; if (var10 > 0.0F) { this.func_130015_b(var10, screenWidth, screenHeight); } } GL11.glBlendFunc(770, 771); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(widgetsTexPath); InventoryPlayer var11 = this.mc.thePlayer.inventory; this.zLevel = -90.0F; this.drawTexturedModalRect(screenWidth / 2 - 91, screenHeight - 22, 0, 0, 182, 22); this.drawTexturedModalRect(screenWidth / 2 - 91 - 1 + var11.currentItem * 20, screenHeight - 22 - 1, 0, 22, 24, 22); this.mc.getTextureManager().bindTexture(icons); GL11.glEnable(3042 ); GL11.glBlendFunc(775, 769); this.drawTexturedModalRect(screenWidth / 2 - 7, screenHeight / 2 - 7, 0, 0, 16, 16); GL11.glDisable(3042 ); GuiIngame.rand.setSeed((long) (this.updateCounter * 312871)); int var15; int var17; this.renderBossHealth(); if (needsUpdate && mainScreen.getHealthBar().isVisible() == mc.playerController.isInCreativeMode()) { mainScreen.toggleSurvivalHUD(!mc.playerController.isInCreativeMode()); } needsUpdate = false; mainScreen.getHungerBar().render(); mainScreen.getArmorBar().render(); mainScreen.getHealthBar().render(); mainScreen.getBubbleBar().render(); mainScreen.getExpBar().render(); map.onRenderTick(); GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.startSection(STR); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (var15 = 0; var15 < 9; ++var15) { int x = screenWidth / 2 - 90 + var15 * 20 + 2; var17 = screenHeight - 16 - 3; this.renderInventorySlot(var15, x, var17, f); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); this.mc.mcProfiler.endSection(); if (this.mc.thePlayer.getSleepTimer() > 0) { GL11.glDisable(2929 ); GL11.glDisable(3008 ); var15 = this.mc.thePlayer.getSleepTimer(); float var26 = (float)var15 / 100.0F; if (var26 > 1.0F) { var26 = 1.0F - (float)(var15 - 100) / 10.0F; } var17 = (int)(220.0F * var26) << 24 1052704; this.drawRect(0, 0, screenWidth, screenHeight, var17); GL11.glEnable(3008 ); GL11.glEnable(2929 ); } mainScreen.render(); int var111; var111 = screenWidth / 2 - 91; int var12; int var13; int var14; int var115; int var117; int var16; float var33; float var313; short var317; if (this.mc.thePlayer.isRidingHorse()) { this.mc.mcProfiler.startSection(STR); this.mc.getTextureManager().bindTexture(Gui.icons); var313 = this.mc.thePlayer.getHorseJumpPower(); var317 = 182; var14 = (int)(var313 * (float)(var317 + 1)); var115 = screenHeight - 32 + 3; this.drawTexturedModalRect(var111, var115, 0, 84, var317, 5); if (var14 > 0) { this.drawTexturedModalRect(var111, var115, 0, 89, var14, 5); } this.mc.mcProfiler.endSection(); } else if (this.mc.playerController.func_78763_f()) { } if (this.mc.gameSettings.showDebugInfo) { this.mc.mcProfiler.startSection("debug"); GL11.glPushMatrix(); if (Configuration.getFastDebug() != 2) { font.drawStringWithShadow(STR + this.mc.debug + ")", 2, 2, 16777215); font.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215); font.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215); font.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215); font.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215); long var41 = Runtime.getRuntime().maxMemory(); long var34 = Runtime.getRuntime().totalMemory(); long var42 = Runtime.getRuntime().freeMemory(); long var43 = var34 - var42; String var45 = STR + var43 * 100L / var41 + STR + var43 / 1024L / 1024L + STR + var41 / 1024L / 1024L + "MB"; this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 2, 14737632); var45 = STR + var34 * 100L / var41 + STR + var34 / 1024L / 1024L + "MB)"; this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 12, 14737632); int var47 = MathHelper.floor_double(this.mc.thePlayer.posX); int var22 = MathHelper.floor_double(this.mc.thePlayer.posY); int var23 = MathHelper.floor_double(this.mc.thePlayer.posZ); if(SpoutClient.getInstance().isCoordsCheat()) { this.drawString(font, String.format(STRy: %.3f (feet pos, %.3f eyes pos)STRz: %.5f (%d) int var24 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; this.drawString(font, STR + var24 + STR + Direction.directions[var24] + STR + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632); } if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var47, var22, var23)) { Chunk var48 = this.mc.theWorld.getChunkFromBlockCoords(var47, var23); this.drawString(font, STR + (var48.getTopFilledSegment() + 15) + STR + var48.getBiomeGenForWorldCoords(var47 & 15, var23 & 15, this.mc.theWorld.getWorldChunkManager()).biomeName + STR + var48.getSavedLightValue(EnumSkyBlock.Block, var47 & 15, var22, var23 & 15) + STR + var48.getSavedLightValue(EnumSkyBlock.Sky, var47 & 15, var22, var23 & 15) + STR + var48.getBlockLightValue(var47 & 15, var22, var23 & 15, 0), 2, 96, 14737632); } this.drawString(font, String.format(STR, new Object[] {Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()), Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23))}), 2, 104, 14737632); } else { font.drawStringWithShadow(Integer.toString(Minecraft.framesPerSecond), 4, 2, 0xFFE303); } this.mc.mcProfiler.endSection(); GL11.glPopMatrix(); if (this.recordPlayingUpFor > 0) { this.mc.mcProfiler.startSection(STR); var33 = (float)this.recordPlayingUpFor - f; var12 = (int)(var33 * 256.0F / 20.0F); if (var12 > 255) { var12 = 255; } if (var12 > 0) { GL11.glPushMatrix(); GL11.glTranslatef((float)(screenWidth / 2), (float)(screenHeight - 48), 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); var13 = 16777215; if (this.recordIsPlaying) { var13 = Color.HSBtoRGB(var33 / 50.0F, 0.7F, 0.6F) & 16777215; } font.drawString(this.recordPlaying, -font.getStringWidth(this.recordPlaying) / 2, -4, var13 + (var12 << 24)); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } this.mc.mcProfiler.endSection(); } } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPushMatrix(); int var38; float pHealth; float ppHealth; if (Configuration.showHotbarText) { String var35; String custom = null; pHealth = this.mc.thePlayer.getHealth(); ppHealth = this.mc.thePlayer.prevHealth; String var34 = STRtoolHighlightSTR\nSTRchatSTRplayerListSTR" + var56.getScorePoints(); font.drawStringWithShadow(var57, var50 - font.getStringWidth(var57), var47, 16777215); } } this.mc.getTextureManager().bindTexture(icons); byte var50 = 0; boolean var48 = false; byte var49; if (var46.responseTime < 0) { var49 = 5; } else if (var46.responseTime < 150) { var49 = 0; } else if (var46.responseTime < 300) { var49 = 1; } else if (var46.responseTime < 600) { var49 = 2; } else if (var46.responseTime < 1000) { var49 = 3; } else { var49 = 4; } this.zLevel += 100.0F; this.drawTexturedModalRect(var20 + var16 - 12, var47, 0 + var50 * 10, 176 + var49 * 8, 10, 8); this.zLevel -= 100.0F; } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); } | /**
* Render the ingame overlay with quick icon bar, ...
*/ | Render the ingame overlay with quick icon bar, .. | renderGameOverlay | {
"repo_name": "Spoutcraft/Spoutcraft",
"path": "src/main/java/net/minecraft/src/GuiIngame.java",
"license": "lgpl-3.0",
"size": 31753
} | [
"java.awt.Color",
"org.spoutcraft.api.gui.InGameHUD",
"org.spoutcraft.client.SpoutClient",
"org.spoutcraft.client.config.Configuration"
] | import java.awt.Color; import org.spoutcraft.api.gui.InGameHUD; import org.spoutcraft.client.SpoutClient; import org.spoutcraft.client.config.Configuration; | import java.awt.*; import org.spoutcraft.api.gui.*; import org.spoutcraft.client.*; import org.spoutcraft.client.config.*; | [
"java.awt",
"org.spoutcraft.api",
"org.spoutcraft.client"
] | java.awt; org.spoutcraft.api; org.spoutcraft.client; | 94,827 |
TranslatorBuilder messageArguments(Map<String, Object> messageArguments); | TranslatorBuilder messageArguments(Map<String, Object> messageArguments); | /**
* Sets the message arguments as a map of objects with key as named argument.
*
* @param messageArguments a map of objects for message arguments.
* @return the translator builder.
*/ | Sets the message arguments as a map of objects with key as named argument | messageArguments | {
"repo_name": "vsplf/vsplf-dynamic-i18n",
"path": "vsplf-dynamic-i18n-api/src/main/java/org/vsplf/i18n/TranslatorBuilder.java",
"license": "apache-2.0",
"size": 2934
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 876,957 |
public void init(Camera camera);
| void function(Camera camera); | /**
* Initializes the camera preview.
*
* @param camera A camera object.
*/ | Initializes the camera preview | init | {
"repo_name": "foliveira/implant",
"path": "src/pt/com/gmv/lab/implant/interfaces/camera/CameraPreviewHandler.java",
"license": "bsd-3-clause",
"size": 2230
} | [
"android.hardware.Camera"
] | import android.hardware.Camera; | import android.hardware.*; | [
"android.hardware"
] | android.hardware; | 305,307 |
public HttpStatus withHttpHeader(String name, String value)
{
Objects.requireNonNull(name, "Parameter name cannot be null");
Objects.requireNonNull(value, "Parameter value cannot be null");
if (extraHttpHeaders == null)
{
extraHttpHeaders = new HashMap<>(3);
}
extraHttpHeaders.put(name, value);
return this;
} | HttpStatus function(String name, String value) { Objects.requireNonNull(name, STR); Objects.requireNonNull(value, STR); if (extraHttpHeaders == null) { extraHttpHeaders = new HashMap<>(3); } extraHttpHeaders.put(name, value); return this; } | /**
* Sets an HTTP header. If an existing value for this header already exists,
* it gets overwritten. If you need to set multiple headers or add them without
* overwriting existing ones, you need to implement {@link StreamResponse} instead.
*/ | Sets an HTTP header. If an existing value for this header already exists, it gets overwritten. If you need to set multiple headers or add them without overwriting existing ones, you need to implement <code>StreamResponse</code> instead | withHttpHeader | {
"repo_name": "apache/tapestry-5",
"path": "tapestry-core/src/main/java/org/apache/tapestry5/services/HttpStatus.java",
"license": "apache-2.0",
"size": 8173
} | [
"java.util.HashMap",
"java.util.Objects"
] | import java.util.HashMap; import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 515,370 |
public Date getLogDate() {
return logDate;
} | Date function() { return logDate; } | /**
* Gets the date the transformation was logged.
*
* @return the log date
*/ | Gets the date the transformation was logged | getLogDate | {
"repo_name": "alina-ipatina/pentaho-kettle",
"path": "engine/src/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 197880
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,578,092 |
String toStringResponseOnly(BiFunction<? super RequestContext, ? super ResponseHeaders, ?> headersSanitizer,
BiFunction<? super RequestContext, Object, ?> contentSanitizer,
BiFunction<? super RequestContext, ? super HttpHeaders, ?> trailersSanitizer); | String toStringResponseOnly(BiFunction<? super RequestContext, ? super ResponseHeaders, ?> headersSanitizer, BiFunction<? super RequestContext, Object, ?> contentSanitizer, BiFunction<? super RequestContext, ? super HttpHeaders, ?> trailersSanitizer); | /**
* Returns the string representation of the {@link Response}.
*
* @param headersSanitizer a {@link BiFunction} for sanitizing HTTP headers for logging. The result of
* the {@link BiFunction} is what is actually logged as headers.
* @param contentSanitizer a {@link BiFunction} for sanitizing response content for logging. The result of
* the {@link BiFunction} is what is actually logged as content.
* @param trailersSanitizer a {@link BiFunction} for sanitizing HTTP trailers for logging. The result of
* the {@link BiFunction} is what is actually logged as trailers.
*/ | Returns the string representation of the <code>Response</code> | toStringResponseOnly | {
"repo_name": "minwoox/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/logging/RequestLog.java",
"license": "apache-2.0",
"size": 10100
} | [
"com.linecorp.armeria.common.HttpHeaders",
"com.linecorp.armeria.common.RequestContext",
"com.linecorp.armeria.common.ResponseHeaders",
"java.util.function.BiFunction"
] | import com.linecorp.armeria.common.HttpHeaders; import com.linecorp.armeria.common.RequestContext; import com.linecorp.armeria.common.ResponseHeaders; import java.util.function.BiFunction; | import com.linecorp.armeria.common.*; import java.util.function.*; | [
"com.linecorp.armeria",
"java.util"
] | com.linecorp.armeria; java.util; | 2,215,461 |
public List<E> getPageList() {
return getSource().subList(getFirstElementOnPage(), getLastElementOnPage() + 1);
} | List<E> function() { return getSource().subList(getFirstElementOnPage(), getLastElementOnPage() + 1); } | /**
* Return a sub-list representing the current page.
*/ | Return a sub-list representing the current page | getPageList | {
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.beans/org/springframework/beans/support/PagedListHolder.java",
"license": "mit",
"size": 8844
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 85,169 |
public byte[] sign() throws SignatureException {
FlexiBigInt s, m;
byte[] EM;
// 1) EMSA-PSS encoding: Apply the EMSA-PSS encoding operation to the
// message M to produce an encoded message EM of length
// ceil((modBits-1)/8)
// octets such that the bit length of the integer OS2IP (EM) is at most
// modBits-1,
// where modBits is the length in bits of the RSA modulus n:
// EM = EMSA-PSS-ENCODE (M, modBits-1).
// Note that the octet length of EM will be one less than k if modBits-1
// is
// divisible by 8 and equal to k otherwise.
try {
byte[] salt = new byte[params.getSaltLength()];
random.nextBytes(salt);
EM = PKCS1Operations.EMSA_PSS_ENCODE(getMessage(), modBits - 1, md,
salt);
} catch (PKCS1Exception pkcs1e) {
// If the encoding operation outputs "message too long", output
// "message too long" and stop. If the encoding operation outputs
// "encoding error", output "encoding error" and stop.
throw new SignatureException(pkcs1e.getMessage());
} catch (IOException ioe) {
throw new SignatureException(ioe.getMessage());
}
// 2) MpRSA Operation:
// a) Convert the encoded message EM to an integer message
// representative m = OS2IP (EM).
m = PKCS1Operations.OS2IP(EM);
// b) b. Apply the MpRSASP1 signature primitive (equivalent to MpRSADP)
// to
// the
// MpRSA private key K and the message representative m to produce an
// integer
// signature representative s = MpRSASP1 (K, m)
try {
s = MpRSAOperations.MpRSADP(privKey, m);
} catch (PKCS1Exception pkcs1e) {
throw new SignatureException("encoding error.");
}
// c) Convert the signature representative s to a signature S of length
// k octets:
// S = I2OSP (s, k)
// 3) Output the signature S.
try {
return PKCS1Operations.I2OSP(s, (modBits + 7) >> 3);
} catch (PKCS1Exception pkcs1e) {
throw new SignatureException("internal error.");
}
} | byte[] function() throws SignatureException { FlexiBigInt s, m; byte[] EM; try { byte[] salt = new byte[params.getSaltLength()]; random.nextBytes(salt); EM = PKCS1Operations.EMSA_PSS_ENCODE(getMessage(), modBits - 1, md, salt); } catch (PKCS1Exception pkcs1e) { throw new SignatureException(pkcs1e.getMessage()); } catch (IOException ioe) { throw new SignatureException(ioe.getMessage()); } m = PKCS1Operations.OS2IP(EM); try { s = MpRSAOperations.MpRSADP(privKey, m); } catch (PKCS1Exception pkcs1e) { throw new SignatureException(STR); } try { return PKCS1Operations.I2OSP(s, (modBits + 7) >> 3); } catch (PKCS1Exception pkcs1e) { throw new SignatureException(STR); } } | /**
* Signs a message.
*
* @return the signature.
* @throws de.flexiprovider.api.exceptions.SignatureException
* if the signature is not initialized properly.
*/ | Signs a message | sign | {
"repo_name": "sharebookproject/AndroidPQCrypto",
"path": "MCElieceProject/Flexiprovider/src/main/java/de/flexiprovider/core/mprsa/MpRSASignaturePSS.java",
"license": "gpl-3.0",
"size": 11008
} | [
"de.flexiprovider.api.exceptions.SignatureException",
"de.flexiprovider.common.math.FlexiBigInt",
"de.flexiprovider.core.rsa.PKCS1Exception",
"de.flexiprovider.core.rsa.PKCS1Operations",
"java.io.IOException"
] | import de.flexiprovider.api.exceptions.SignatureException; import de.flexiprovider.common.math.FlexiBigInt; import de.flexiprovider.core.rsa.PKCS1Exception; import de.flexiprovider.core.rsa.PKCS1Operations; import java.io.IOException; | import de.flexiprovider.api.exceptions.*; import de.flexiprovider.common.math.*; import de.flexiprovider.core.rsa.*; import java.io.*; | [
"de.flexiprovider.api",
"de.flexiprovider.common",
"de.flexiprovider.core",
"java.io"
] | de.flexiprovider.api; de.flexiprovider.common; de.flexiprovider.core; java.io; | 2,833,977 |
EAttribute getAtlTemplate_Template(); | EAttribute getAtlTemplate_Template(); | /**
* Returns the meta object for the attribute '{@link bento.language.bentocomp.technologies.AtlTemplate#getTemplate <em>Template</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Template</em>'.
* @see bento.language.bentocomp.technologies.AtlTemplate#getTemplate()
* @see #getAtlTemplate()
* @generated
*/ | Returns the meta object for the attribute '<code>bento.language.bentocomp.technologies.AtlTemplate#getTemplate Template</code>'. | getAtlTemplate_Template | {
"repo_name": "jesusc/bento",
"path": "plugins/bento.language.bentocomp/src-gen/bento/language/bentocomp/technologies/TechnologiesPackage.java",
"license": "epl-1.0",
"size": 14304
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,303,735 |
public Tree parse(String sentence) {
List<? extends HasWord> tokens = tokenize(sentence);
if (getOp().testOptions.preTag) {
Function<List<? extends HasWord>, List<TaggedWord>> tagger = loadTagger();
tokens = tagger.apply(tokens);
}
return parse(tokens);
}
private transient Function<List<? extends HasWord>, List<TaggedWord>> tagger;
private transient String taggerPath; | Tree function(String sentence) { List<? extends HasWord> tokens = tokenize(sentence); if (getOp().testOptions.preTag) { Function<List<? extends HasWord>, List<TaggedWord>> tagger = loadTagger(); tokens = tagger.apply(tokens); } return parse(tokens); } private transient Function<List<? extends HasWord>, List<TaggedWord>> tagger; private transient String taggerPath; | /**
* Will parse the text in <code>sentence</code> as if it represented
* a single sentence by first processing it with a tokenizer.
*/ | Will parse the text in <code>sentence</code> as if it represented a single sentence by first processing it with a tokenizer | parse | {
"repo_name": "hbbpb/stanford-corenlp-gv",
"path": "src/edu/stanford/nlp/parser/common/ParserGrammar.java",
"license": "gpl-2.0",
"size": 6674
} | [
"edu.stanford.nlp.ling.HasWord",
"edu.stanford.nlp.ling.TaggedWord",
"edu.stanford.nlp.trees.Tree",
"java.util.List",
"java.util.function.Function"
] | import edu.stanford.nlp.ling.HasWord; import edu.stanford.nlp.ling.TaggedWord; import edu.stanford.nlp.trees.Tree; import java.util.List; import java.util.function.Function; | import edu.stanford.nlp.ling.*; import edu.stanford.nlp.trees.*; import java.util.*; import java.util.function.*; | [
"edu.stanford.nlp",
"java.util"
] | edu.stanford.nlp; java.util; | 676,630 |
public TimeRange getTimeRange() {
return this.tr;
} | TimeRange function() { return this.tr; } | /**
* Gets the TimeRange used for this increment.
* @return TimeRange
*/ | Gets the TimeRange used for this increment | getTimeRange | {
"repo_name": "ultratendency/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java",
"license": "apache-2.0",
"size": 11162
} | [
"org.apache.hadoop.hbase.io.TimeRange"
] | import org.apache.hadoop.hbase.io.TimeRange; | import org.apache.hadoop.hbase.io.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,579,909 |
public boolean isOffsetPositionInLiquid(double x, double y, double z)
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().offset(x, y, z);
return this.isLiquidPresentInAABB(axisalignedbb);
} | boolean function(double x, double y, double z) { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().offset(x, y, z); return this.isLiquidPresentInAABB(axisalignedbb); } | /**
* Checks if the offset position from the entity's current position is inside of liquid. Args: x, y, z
*/ | Checks if the offset position from the entity's current position is inside of liquid. Args: x, y, z | isOffsetPositionInLiquid | {
"repo_name": "kelthalorn/ConquestCraft",
"path": "build/tmp/recompSrc/net/minecraft/entity/Entity.java",
"license": "lgpl-2.1",
"size": 97307
} | [
"net.minecraft.util.AxisAlignedBB"
] | import net.minecraft.util.AxisAlignedBB; | import net.minecraft.util.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 1,223,554 |
protected List<SpringPersistenceUnitInfo> parseDocument(
Resource resource, Document document, List<SpringPersistenceUnitInfo> infos) throws IOException {
Element persistence = document.getDocumentElement();
URL unitRootURL = determinePersistenceUnitRootUrl(resource);
List<Element> units = (List<Element>) DomUtils.getChildElementsByTagName(persistence, PERSISTENCE_UNIT);
for (Element unit : units) {
SpringPersistenceUnitInfo info = parsePersistenceUnitInfo(unit);
info.setPersistenceUnitRootUrl(unitRootURL);
infos.add(info);
}
return infos;
} | List<SpringPersistenceUnitInfo> function( Resource resource, Document document, List<SpringPersistenceUnitInfo> infos) throws IOException { Element persistence = document.getDocumentElement(); URL unitRootURL = determinePersistenceUnitRootUrl(resource); List<Element> units = (List<Element>) DomUtils.getChildElementsByTagName(persistence, PERSISTENCE_UNIT); for (Element unit : units) { SpringPersistenceUnitInfo info = parsePersistenceUnitInfo(unit); info.setPersistenceUnitRootUrl(unitRootURL); infos.add(info); } return infos; } | /**
* Parse the validated document and populates(add to) the given unit info
* list.
*/ | Parse the validated document and populates(add to) the given unit info list | parseDocument | {
"repo_name": "mattxia/spring-2.5-analysis",
"path": "tiger/src/org/springframework/orm/jpa/persistenceunit/PersistenceUnitReader.java",
"license": "apache-2.0",
"size": 13233
} | [
"java.io.IOException",
"java.util.List",
"org.springframework.core.io.Resource",
"org.springframework.util.xml.DomUtils",
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import java.io.IOException; import java.util.List; import org.springframework.core.io.Resource; import org.springframework.util.xml.DomUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; | import java.io.*; import java.util.*; import org.springframework.core.io.*; import org.springframework.util.xml.*; import org.w3c.dom.*; | [
"java.io",
"java.util",
"org.springframework.core",
"org.springframework.util",
"org.w3c.dom"
] | java.io; java.util; org.springframework.core; org.springframework.util; org.w3c.dom; | 1,155,749 |
@GET
@Path("/generate")
@Produces("application/json")
public Response generate(@Context UriInfo info) throws Exception {
init();
MultivaluedMap<String,String> params=info.getQueryParameters();
if (params.containsKey("report")) {
String resp="";
java.util.Map<String, Object> props=new java.util.HashMap<String, Object>();
String reportName=params.getFirst("report");
// Copy over parameters, only passing lists where multiple values have been defined
for (String key : params.keySet()) {
java.util.List<String> val=params.get(key);
if (val.size() > 1) {
props.put(key, val);
} else if (val.size() == 1) {
props.put(key, val.get(0));
}
}
// Create start and end date/time
long start=buildDateTime("start", params);
long end=buildDateTime("end", params);
if (start > 0) {
props.put("start", start);
}
if (end > 0) {
props.put("end", end);
}
// Generate report
Report report=_reportManager.generate(reportName, props);
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Generated report="+report);
}
if (report != null) {
byte[] b=ReportsUtil.serializeReport(report);
if (b != null) {
resp = new String(b);
}
}
return (Response.ok(resp).build());
} else {
return (Response.status(Status.BAD_REQUEST).build());
}
} | @Path(STR) @Produces(STR) Response function(@Context UriInfo info) throws Exception { init(); MultivaluedMap<String,String> params=info.getQueryParameters(); if (params.containsKey(STR)) { String resp=""; java.util.Map<String, Object> props=new java.util.HashMap<String, Object>(); String reportName=params.getFirst(STR); for (String key : params.keySet()) { java.util.List<String> val=params.get(key); if (val.size() > 1) { props.put(key, val); } else if (val.size() == 1) { props.put(key, val.get(0)); } } long start=buildDateTime("startSTRendSTRstartSTRendSTRGenerated report="+report); } if (report != null) { byte[] b=ReportsUtil.serializeReport(report); if (b != null) { resp = new String(b); } } return (Response.ok(resp).build()); } else { return (Response.status(Status.BAD_REQUEST).build()); } } | /**
* This method generates a report based on the supplied
* query parameters.
*
* @param info The URI info
* @return The report
* @throws Exception Failed to generate the report
*/ | This method generates a report based on the supplied query parameters | generate | {
"repo_name": "jorgemoralespou/rtgov",
"path": "modules/activity-analysis/reports-rests/src/main/java/org/overlord/rtgov/reports/rest/RESTReportServer.java",
"license": "apache-2.0",
"size": 6494
} | [
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.core.Context",
"javax.ws.rs.core.MultivaluedMap",
"javax.ws.rs.core.Response",
"javax.ws.rs.core.UriInfo",
"org.overlord.rtgov.reports.util.ReportsUtil"
] | import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.overlord.rtgov.reports.util.ReportsUtil; | import javax.ws.rs.*; import javax.ws.rs.core.*; import org.overlord.rtgov.reports.util.*; | [
"javax.ws",
"org.overlord.rtgov"
] | javax.ws; org.overlord.rtgov; | 1,265,067 |
public IgniteInternalFuture<Long> topologyFuture(final long awaitVer) {
long topVer = topologyVersion();
if (topVer >= awaitVer)
return new GridFinishedFuture<>(topVer);
DiscoTopologyFuture fut = new DiscoTopologyFuture(ctx, awaitVer);
fut.init();
return fut;
} | IgniteInternalFuture<Long> function(final long awaitVer) { long topVer = topologyVersion(); if (topVer >= awaitVer) return new GridFinishedFuture<>(topVer); DiscoTopologyFuture fut = new DiscoTopologyFuture(ctx, awaitVer); fut.init(); return fut; } | /**
* Gets future that will be completed when current topology version becomes greater or equal to argument passed.
*
* @param awaitVer Topology version to await.
* @return Future.
*/ | Gets future that will be completed when current topology version becomes greater or equal to argument passed | topologyFuture | {
"repo_name": "agoncharuk/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java",
"license": "apache-2.0",
"size": 104025
} | [
"org.apache.ignite.internal.IgniteInternalFuture",
"org.apache.ignite.internal.util.future.GridFinishedFuture"
] | import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.future.GridFinishedFuture; | import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.future.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,709,203 |
public ReleaseDefinition createReleaseDefinition(
final ReleaseDefinition releaseDefinition,
final String project) {
final UUID locationId = UUID.fromString("d8f96f24-8ea7-4cb6-baab-2df8fc515665"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.3"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("project", project); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.POST,
locationId,
routeValues,
apiVersion,
releaseDefinition,
VssMediaTypes.APPLICATION_JSON_TYPE,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, ReleaseDefinition.class);
} | ReleaseDefinition function( final ReleaseDefinition releaseDefinition, final String project) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); final VssRestRequest httpRequest = super.createRequest(HttpMethod.POST, locationId, routeValues, apiVersion, releaseDefinition, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, ReleaseDefinition.class); } | /**
* [Preview API 3.1-preview.3]
*
* @param releaseDefinition
*
* @param project
* Project ID or project name
* @return ReleaseDefinition
*/ | [Preview API 3.1-preview.3] | createReleaseDefinition | {
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-releasemanagement-client/src/main/generated/com/microsoft/alm/visualstudio/services/releasemanagement/webapi/ReleaseHttpClientBase.java",
"license": "mit",
"size": 186198
} | [
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.visualstudio.services.releasemanagement.webapi.ReleaseDefinition",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] | import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.ReleaseDefinition; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.microsoft.alm.client.*; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*; | [
"com.microsoft.alm",
"java.util"
] | com.microsoft.alm; java.util; | 321,809 |
public void serialize(XmlSerializer serializer, String elementName, Object element)
throws IOException {
serialize(serializer, elementName, element, true);
} | void function(XmlSerializer serializer, String elementName, Object element) throws IOException { serialize(serializer, elementName, element, true); } | /**
* Shows a debug string representation of an element data object of key/value pairs.
*
* @param element element data object ({@link GenericXml}, {@link Map}, or any object with public
* fields)
* @param elementName XML element local name prefixed by its namespace alias
* @throws IOException I/O exception
*/ | Shows a debug string representation of an element data object of key/value pairs | serialize | {
"repo_name": "googleapis/google-http-java-client",
"path": "google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java",
"license": "apache-2.0",
"size": 16741
} | [
"java.io.IOException",
"org.xmlpull.v1.XmlSerializer"
] | import java.io.IOException; import org.xmlpull.v1.XmlSerializer; | import java.io.*; import org.xmlpull.v1.*; | [
"java.io",
"org.xmlpull.v1"
] | java.io; org.xmlpull.v1; | 1,760,234 |
public int getSequencePreallocationSize() {
if (!(getSession().getDatasourceLogin() instanceof DatabaseLogin)) {
return 0;
}
return ((DatasourcePlatform)getSession().getDatasourcePlatform()).getSequencePreallocationSize();
} | int function() { if (!(getSession().getDatasourceLogin() instanceof DatabaseLogin)) { return 0; } return ((DatasourcePlatform)getSession().getDatasourcePlatform()).getSequencePreallocationSize(); } | /**
* Method returns the value of the Sequence Preallocation size
*/ | Method returns the value of the Sequence Preallocation size | getSequencePreallocationSize | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/services/RuntimeServices.java",
"license": "epl-1.0",
"size": 71544
} | [
"org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform",
"org.eclipse.persistence.sessions.DatabaseLogin"
] | import org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform; import org.eclipse.persistence.sessions.DatabaseLogin; | import org.eclipse.persistence.internal.databaseaccess.*; import org.eclipse.persistence.sessions.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 2,306,058 |
public static INDArray movingAverage(INDArray toAvg, int n) {
INDArray ret = Nd4j.cumsum(toAvg);
INDArrayIndex[] ends = new INDArrayIndex[] {NDArrayIndex.interval(n, toAvg.columns())};
INDArrayIndex[] begins = new INDArrayIndex[] {NDArrayIndex.interval(0, toAvg.columns() - n, false)};
INDArrayIndex[] nMinusOne = new INDArrayIndex[] {NDArrayIndex.interval(n - 1, toAvg.columns())};
ret.put(ends, ret.get(ends).sub(ret.get(begins)));
return ret.get(nMinusOne).divi(n);
} | static INDArray function(INDArray toAvg, int n) { INDArray ret = Nd4j.cumsum(toAvg); INDArrayIndex[] ends = new INDArrayIndex[] {NDArrayIndex.interval(n, toAvg.columns())}; INDArrayIndex[] begins = new INDArrayIndex[] {NDArrayIndex.interval(0, toAvg.columns() - n, false)}; INDArrayIndex[] nMinusOne = new INDArrayIndex[] {NDArrayIndex.interval(n - 1, toAvg.columns())}; ret.put(ends, ret.get(ends).sub(ret.get(begins))); return ret.get(nMinusOne).divi(n); } | /**
* Calculate a moving average given the length
* @param toAvg the array to average
* @param n the length of the moving window
* @return the moving averages for each row
*/ | Calculate a moving average given the length | movingAverage | {
"repo_name": "deeplearning4j/deeplearning4j",
"path": "deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java",
"license": "apache-2.0",
"size": 20849
} | [
"org.nd4j.linalg.api.ndarray.INDArray",
"org.nd4j.linalg.factory.Nd4j",
"org.nd4j.linalg.indexing.INDArrayIndex",
"org.nd4j.linalg.indexing.NDArrayIndex"
] | import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.indexing.INDArrayIndex; import org.nd4j.linalg.indexing.NDArrayIndex; | import org.nd4j.linalg.api.ndarray.*; import org.nd4j.linalg.factory.*; import org.nd4j.linalg.indexing.*; | [
"org.nd4j.linalg"
] | org.nd4j.linalg; | 2,550,815 |
public String hashToHexString(byte[] hash) {
BigInteger bigInt = new BigInteger(1, hash);
long targetLen = md.getDigestLength() * 2;
return String.format("%0" + targetLen + "x", bigInt);
} | String function(byte[] hash) { BigInteger bigInt = new BigInteger(1, hash); long targetLen = md.getDigestLength() * 2; return String.format("%0" + targetLen + "x", bigInt); } | /**
* Convert a hash to a hexidecimal String.
*
* @param hash the hash value to convert
*
* @return zero-padded hex String representation of the hash.
*/ | Convert a hash to a hexidecimal String | hashToHexString | {
"repo_name": "jkachika/galileo",
"path": "src/galileo/util/Checksum.java",
"license": "bsd-2-clause",
"size": 3494
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 2,705,053 |
private static void removeInactivePaths( TransMeta trans, List<StepMeta> steps ) {
if ( steps == null ) {
List<TransHopMeta> disabledHops = findHops( trans, hop -> !hop.isEnabled() );
List<StepMeta> disabledSteps = disabledHops.stream()
.map( hop -> hop.getToStep() ).collect( Collectors.toList() );
removeInactivePaths( trans, disabledSteps );
} else {
for ( StepMeta step : steps ) {
List<TransHopMeta> enabledInHops = findHops( trans, hop -> hop.getToStep().equals( step )
&& hop.isEnabled() );
List<TransHopMeta> disabledInHops = findHops( trans, hop -> hop.getToStep().equals( step )
&& !hop.isEnabled() );
if ( enabledInHops.size() == 0 ) {
List<StepMeta> nextSteps = trans.findNextSteps( step );
findHops( trans, hop -> hop.getToStep().equals( step ) || hop.getFromStep().equals( step ) )
.forEach( trans::removeTransHop );
trans.getSteps().remove( step );
removeInactivePaths( trans, nextSteps );
} else {
disabledInHops.forEach( trans::removeTransHop );
}
}
}
} | static void function( TransMeta trans, List<StepMeta> steps ) { if ( steps == null ) { List<TransHopMeta> disabledHops = findHops( trans, hop -> !hop.isEnabled() ); List<StepMeta> disabledSteps = disabledHops.stream() .map( hop -> hop.getToStep() ).collect( Collectors.toList() ); removeInactivePaths( trans, disabledSteps ); } else { for ( StepMeta step : steps ) { List<TransHopMeta> enabledInHops = findHops( trans, hop -> hop.getToStep().equals( step ) && hop.isEnabled() ); List<TransHopMeta> disabledInHops = findHops( trans, hop -> hop.getToStep().equals( step ) && !hop.isEnabled() ); if ( enabledInHops.size() == 0 ) { List<StepMeta> nextSteps = trans.findNextSteps( step ); findHops( trans, hop -> hop.getToStep().equals( step ) hop.getFromStep().equals( step ) ) .forEach( trans::removeTransHop ); trans.getSteps().remove( step ); removeInactivePaths( trans, nextSteps ); } else { disabledInHops.forEach( trans::removeTransHop ); } } } } | /**
* Removes steps which cannot be reached using enabled hops. Steps removed along with every input and
* output hops they have. Downstream steps processed recursively in the same way. Should be invoked with null second arg.
*
* @param trans trans object to process
* @param steps
*/ | Removes steps which cannot be reached using enabled hops. Steps removed along with every input and output hops they have. Downstream steps processed recursively in the same way. Should be invoked with null second arg | removeInactivePaths | {
"repo_name": "hudak/pentaho-kettle",
"path": "engine/src/org/pentaho/di/trans/ael/adapters/TransMetaConverter.java",
"license": "apache-2.0",
"size": 7495
} | [
"java.util.List",
"java.util.stream.Collectors",
"org.pentaho.di.trans.TransHopMeta",
"org.pentaho.di.trans.TransMeta",
"org.pentaho.di.trans.step.StepMeta"
] | import java.util.List; import java.util.stream.Collectors; import org.pentaho.di.trans.TransHopMeta; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.StepMeta; | import java.util.*; import java.util.stream.*; import org.pentaho.di.trans.*; import org.pentaho.di.trans.step.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 1,482,232 |
@Test
public void simpleSuccess() throws ConfigurationBeanLoaderException {
model.add(typeStatement(SIMPLE_SUCCESS_INSTANCE_URI,
toJavaUri(SimpleSuccess.class)));
SimpleSuccess instance = loader.loadInstance(
SIMPLE_SUCCESS_INSTANCE_URI, SimpleSuccess.class);
assertNotNull(instance);
} | void function() throws ConfigurationBeanLoaderException { model.add(typeStatement(SIMPLE_SUCCESS_INSTANCE_URI, toJavaUri(SimpleSuccess.class))); SimpleSuccess instance = loader.loadInstance( SIMPLE_SUCCESS_INSTANCE_URI, SimpleSuccess.class); assertNotNull(instance); } | /**
* Has a concrete result class.
*/ | Has a concrete result class | simpleSuccess | {
"repo_name": "vivo-project/Vitro",
"path": "api/src/test/java/edu/cornell/mannlib/vitro/webapp/utils/configuration/ConfigurationBeanLoaderTest.java",
"license": "bsd-3-clause",
"size": 22621
} | [
"edu.cornell.mannlib.vitro.webapp.utils.configuration.ConfigurationBeanLoader",
"org.junit.Assert"
] | import edu.cornell.mannlib.vitro.webapp.utils.configuration.ConfigurationBeanLoader; import org.junit.Assert; | import edu.cornell.mannlib.vitro.webapp.utils.configuration.*; import org.junit.*; | [
"edu.cornell.mannlib",
"org.junit"
] | edu.cornell.mannlib; org.junit; | 20,041 |
protected void computeLayer(final int currentLayer) {
final int inputIndex = this.layerIndex[currentLayer];
final int outputIndex = this.layerIndex[currentLayer - 1];
final int inputSize = this.layerCounts[currentLayer];
final int outputSize = this.layerFeedCounts[currentLayer - 1];
final double dropoutRate;
if(this.layerDropoutRates.length > currentLayer - 1) {
dropoutRate = this.layerDropoutRates[currentLayer - 1];
} else {
dropoutRate = 0;
}
int index = this.weightIndex[currentLayer - 1];
final int limitX = outputIndex + outputSize;
final int limitY = inputIndex + inputSize;
// weight values
for (int x = outputIndex; x < limitX; x++) {
double sum = 0;
for (int y = inputIndex; y < limitY; y++) {
sum += this.weights[index++] * this.layerOutput[y] * (1 - dropoutRate);
}
this.layerSums[x] = sum;
this.layerOutput[x] = sum;
}
this.activationFunctions[currentLayer - 1].activationFunction(
this.layerOutput, outputIndex, outputSize);
// update context values
final int offset = this.contextTargetOffset[currentLayer];
EngineArray.arrayCopy(this.layerOutput, outputIndex,
this.layerOutput, offset, this.contextTargetSize[currentLayer]);
} | void function(final int currentLayer) { final int inputIndex = this.layerIndex[currentLayer]; final int outputIndex = this.layerIndex[currentLayer - 1]; final int inputSize = this.layerCounts[currentLayer]; final int outputSize = this.layerFeedCounts[currentLayer - 1]; final double dropoutRate; if(this.layerDropoutRates.length > currentLayer - 1) { dropoutRate = this.layerDropoutRates[currentLayer - 1]; } else { dropoutRate = 0; } int index = this.weightIndex[currentLayer - 1]; final int limitX = outputIndex + outputSize; final int limitY = inputIndex + inputSize; for (int x = outputIndex; x < limitX; x++) { double sum = 0; for (int y = inputIndex; y < limitY; y++) { sum += this.weights[index++] * this.layerOutput[y] * (1 - dropoutRate); } this.layerSums[x] = sum; this.layerOutput[x] = sum; } this.activationFunctions[currentLayer - 1].activationFunction( this.layerOutput, outputIndex, outputSize); final int offset = this.contextTargetOffset[currentLayer]; EngineArray.arrayCopy(this.layerOutput, outputIndex, this.layerOutput, offset, this.contextTargetSize[currentLayer]); } | /**
* Calculate a layer.
*
* @param currentLayer
* The layer to calculate.
*/ | Calculate a layer | computeLayer | {
"repo_name": "krzysztof-magosa/encog-java-core",
"path": "src/main/java/org/encog/neural/flat/FlatNetwork.java",
"license": "apache-2.0",
"size": 25536
} | [
"org.encog.util.EngineArray"
] | import org.encog.util.EngineArray; | import org.encog.util.*; | [
"org.encog.util"
] | org.encog.util; | 946,045 |
@Test(expected = NoSuchElementException.class)
public void testIteratorNextException() {
final Integer expResult = 32;
instance.add(expResult);
Iterator<Integer> iterator = instance.iterator();
iterator.next();
final Integer result = iterator.next();
assertEquals(expResult, result);
} | @Test(expected = NoSuchElementException.class) void function() { final Integer expResult = 32; instance.add(expResult); Iterator<Integer> iterator = instance.iterator(); iterator.next(); final Integer result = iterator.next(); assertEquals(expResult, result); } | /**
* Test of iterator method.
*/ | Test of iterator method | testIteratorNextException | {
"repo_name": "CkimiHoK/JavaFromZeroToJunior",
"path": "javalearning/Chapter5/src/test/java/ru/aveselov/lesson3/linked/MyLinkedListTest.java",
"license": "apache-2.0",
"size": 5312
} | [
"java.util.Iterator",
"java.util.NoSuchElementException",
"org.junit.Assert",
"org.junit.Test"
] | import java.util.Iterator; import java.util.NoSuchElementException; import org.junit.Assert; import org.junit.Test; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 2,678,518 |
public String createFullURL(Identifier id) {
int size = id.components().size();
if (size == 1) {
return createFullURL(id.getDatabaseName(), null, null);
} else if (size == 2) {
return createFullURL(id.getDatabaseName(), id.getTableName(), null);
} else { // size should == 3
return createFullURL(id.getDatabaseName(), id.getTableName(),
id.components().get(2).toString());
}
} | String function(Identifier id) { int size = id.components().size(); if (size == 1) { return createFullURL(id.getDatabaseName(), null, null); } else if (size == 2) { return createFullURL(id.getDatabaseName(), id.getTableName(), null); } else { return createFullURL(id.getDatabaseName(), id.getTableName(), id.components().get(2).toString()); } } | /**
* Creates a full usable REST URL based on the passed in parameters.
*
* @param id Identifier for what we are looking to create a URL for.
* @return
*/ | Creates a full usable REST URL based on the passed in parameters | createFullURL | {
"repo_name": "Ampliciti/DocussandraJavaSDK",
"path": "src/main/java/com/ampliciti/db/docussandra/javasdk/dao/impl/parent/DaoParent.java",
"license": "apache-2.0",
"size": 14384
} | [
"com.pearson.docussandra.domain.objects.Identifier"
] | import com.pearson.docussandra.domain.objects.Identifier; | import com.pearson.docussandra.domain.objects.*; | [
"com.pearson.docussandra"
] | com.pearson.docussandra; | 2,467,146 |
private Map<String, AboutInfo> createNewBundleGroupsMap() {
// retrieve list of installed bundle groups from last session
IDialogSettings settings = IDEWorkbenchPlugin.getDefault()
.getDialogSettings();
String[] previousFeaturesArray = settings.getArray(INSTALLED_FEATURES);
// get a map of currently installed bundle groups and store it for next
// session
Map<String, AboutInfo> bundleGroups = computeBundleGroupMap();
String[] currentFeaturesArray = new String[bundleGroups.size()];
bundleGroups.keySet().toArray(currentFeaturesArray);
settings.put(INSTALLED_FEATURES, currentFeaturesArray);
// remove the previously known from the current set
if (previousFeaturesArray != null) {
for (int i = 0; i < previousFeaturesArray.length; ++i) {
bundleGroups.remove(previousFeaturesArray[i]);
}
}
return bundleGroups;
} | Map<String, AboutInfo> function() { IDialogSettings settings = IDEWorkbenchPlugin.getDefault() .getDialogSettings(); String[] previousFeaturesArray = settings.getArray(INSTALLED_FEATURES); Map<String, AboutInfo> bundleGroups = computeBundleGroupMap(); String[] currentFeaturesArray = new String[bundleGroups.size()]; bundleGroups.keySet().toArray(currentFeaturesArray); settings.put(INSTALLED_FEATURES, currentFeaturesArray); if (previousFeaturesArray != null) { for (int i = 0; i < previousFeaturesArray.length; ++i) { bundleGroups.remove(previousFeaturesArray[i]); } } return bundleGroups; } | /**
* Updates the old features setting and returns a map of new features.
*/ | Updates the old features setting and returns a map of new features | createNewBundleGroupsMap | {
"repo_name": "pecko/testlimpet",
"path": "info.limpet.rcp/src/info/limpet/rcp/product/ApplicationWorkbenchAdvisor.java",
"license": "epl-1.0",
"size": 30332
} | [
"java.util.Map",
"org.eclipse.jface.dialogs.IDialogSettings",
"org.eclipse.ui.internal.ide.AboutInfo",
"org.eclipse.ui.internal.ide.IDEWorkbenchPlugin"
] | import java.util.Map; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.ui.internal.ide.AboutInfo; import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; | import java.util.*; import org.eclipse.jface.dialogs.*; import org.eclipse.ui.internal.ide.*; | [
"java.util",
"org.eclipse.jface",
"org.eclipse.ui"
] | java.util; org.eclipse.jface; org.eclipse.ui; | 1,086,673 |
public void testBug35945() throws Exception {
PORT1 = ((Integer) server1.invoke(HAInterestBaseTest.class, "createServerCache")).intValue();
server1.invoke(HAInterestBaseTest.class, "createEntriesK1andK2");
createClientPoolCacheConnectionToSingleServer(this.getName(), getServerHostName(server1.getHost()));
registerK1AndK2();
verifyRefreshedEntriesFromServer();
server1.invoke(HAInterestBaseTest.class, "stopServer");
verifyDeadAndLiveServers(1, 0);
// put on stopped server
server1.invoke(HAInterestBaseTest.class, "putK1andK2");
// spawn a thread to put on server , which will acquire a lock on entry
setBridgeObserverForBeforeInterestRecovery();
server1.invoke(HAInterestBaseTest.class, "startServer");
verifyDeadAndLiveServers(0, 1);
waitForBeforeInterestRecoveryCallBack();
// verify updated value of k1 as a refreshEntriesFromServer
final Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r1);
WaitCriterion wc = new WaitCriterion() {
private String excuse; | void function() throws Exception { PORT1 = ((Integer) server1.invoke(HAInterestBaseTest.class, STR)).intValue(); server1.invoke(HAInterestBaseTest.class, STR); createClientPoolCacheConnectionToSingleServer(this.getName(), getServerHostName(server1.getHost())); registerK1AndK2(); verifyRefreshedEntriesFromServer(); server1.invoke(HAInterestBaseTest.class, STR); verifyDeadAndLiveServers(1, 0); server1.invoke(HAInterestBaseTest.class, STR); setBridgeObserverForBeforeInterestRecovery(); server1.invoke(HAInterestBaseTest.class, STR); verifyDeadAndLiveServers(0, 1); waitForBeforeInterestRecoveryCallBack(); final Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME); assertNotNull(r1); WaitCriterion wc = new WaitCriterion() { private String excuse; | /**
* Bug Test for Bug # 35945 A java level Deadlock between acquireConnection
* and RegionEntry during processRecoveredEndpoint by Dead Server Monitor
* Thread.
*
* @throws Exception
*/ | Bug Test for Bug # 35945 A java level Deadlock between acquireConnection and RegionEntry during processRecoveredEndpoint by Dead Server Monitor Thread | testBug35945 | {
"repo_name": "ysung-pivotal/incubator-geode",
"path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java",
"license": "apache-2.0",
"size": 13499
} | [
"com.gemstone.gemfire.cache.Region"
] | import com.gemstone.gemfire.cache.Region; | import com.gemstone.gemfire.cache.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,064,802 |
public static PlayerHistory getMatchHistory(final long summonerID, final List<Long> championIDs) {
return MatchHistoryAPI.getMatchHistory(summonerID, championIDs);
} | static PlayerHistory function(final long summonerID, final List<Long> championIDs) { return MatchHistoryAPI.getMatchHistory(summonerID, championIDs); } | /**
* Gets the 15 most recent matches for the summoner
*
* @param summonerID
* the ID of the summoner to get match history for
* @param championIDs
* the champions to limit games to
* @return the match history for that summoner
* @see <a
* href="https://developer.riotgames.com/api/methods#!/966/3312">Riot
* API Specification</a>
*/ | Gets the 15 most recent matches for the summoner | getMatchHistory | {
"repo_name": "prefanatic/Orianna",
"path": "src/com/robrua/orianna/api/dto/BaseRiotAPI.java",
"license": "mit",
"size": 51138
} | [
"com.robrua.orianna.type.dto.matchhistory.PlayerHistory",
"java.util.List"
] | import com.robrua.orianna.type.dto.matchhistory.PlayerHistory; import java.util.List; | import com.robrua.orianna.type.dto.matchhistory.*; import java.util.*; | [
"com.robrua.orianna",
"java.util"
] | com.robrua.orianna; java.util; | 70,558 |
public static List<NabuccoPropertyDescriptor> getPropertyDescriptorList() {
return PropertyCache.getInstance().retrieve(PropertyComposite.class).getAllProperties();
} | static List<NabuccoPropertyDescriptor> function() { return PropertyCache.getInstance().retrieve(PropertyComposite.class).getAllProperties(); } | /**
* Getter for the PropertyDescriptorList.
*
* @return the List<NabuccoPropertyDescriptor>.
*/ | Getter for the PropertyDescriptorList | getPropertyDescriptorList | {
"repo_name": "NABUCCO/org.nabucco.testautomation",
"path": "org.nabucco.testautomation.facade.datatype/src/main/gen/org/nabucco/testautomation/facade/datatype/property/base/PropertyComposite.java",
"license": "epl-1.0",
"size": 6242
} | [
"java.util.List",
"org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor",
"org.nabucco.framework.base.facade.datatype.property.PropertyCache"
] | import java.util.List; import org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor; import org.nabucco.framework.base.facade.datatype.property.PropertyCache; | import java.util.*; import org.nabucco.framework.base.facade.datatype.property.*; | [
"java.util",
"org.nabucco.framework"
] | java.util; org.nabucco.framework; | 386,019 |
private void stopRing() {
if (defaultRingtone != null && defaultRingtone.isPlaying()) {
defaultRingtone.stop();
}
audio.setStreamVolume(AudioManager.STREAM_RING, DEFAULT_VOLUME, DEFAULT_FLAG);
audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
} | void function() { if (defaultRingtone != null && defaultRingtone.isPlaying()) { defaultRingtone.stop(); } audio.setStreamVolume(AudioManager.STREAM_RING, DEFAULT_VOLUME, DEFAULT_FLAG); audio.setRingerMode(AudioManager.RINGER_MODE_SILENT); } | /**
* This method stops the device ring.
*/ | This method stops the device ring | stopRing | {
"repo_name": "Malintha/product-emm",
"path": "modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/AlertActivity.java",
"license": "apache-2.0",
"size": 8975
} | [
"android.media.AudioManager"
] | import android.media.AudioManager; | import android.media.*; | [
"android.media"
] | android.media; | 438,705 |
// request for natural language understanding results
CompletionStage<JsonNode> luisResponsePromise = fetchLuisApi(query);
JsonNode luisResponse = luisResponsePromise.toCompletableFuture().get();
// classify those results
return getTopScoringIntentEntity(luisResponse);
} | CompletionStage<JsonNode> luisResponsePromise = fetchLuisApi(query); JsonNode luisResponse = luisResponsePromise.toCompletableFuture().get(); return getTopScoringIntentEntity(luisResponse); } | /**
* This method first requests for LUIS, then get the intent
* and entities with top scores. Score is the way LUIS use
* to measure the confidence on language understanding result.
*
* @param query a question from user slack channel
* @return the result of classification performed by LUIS on the asked query as a JSON object.
*/ | This method first requests for LUIS, then get the intent and entities with top scores. Score is the way LUIS use to measure the confidence on language understanding result | interpretQuery | {
"repo_name": "agiledigital/poet-slack-bot",
"path": "server/app/services/LuisServiceProvider.java",
"license": "apache-2.0",
"size": 3081
} | [
"com.fasterxml.jackson.databind.JsonNode",
"java.util.concurrent.CompletionStage"
] | import com.fasterxml.jackson.databind.JsonNode; import java.util.concurrent.CompletionStage; | import com.fasterxml.jackson.databind.*; import java.util.concurrent.*; | [
"com.fasterxml.jackson",
"java.util"
] | com.fasterxml.jackson; java.util; | 1,794,555 |
private static final void writeIntoStream(final ByteBuffer bytebuf, final FileChannel fc, final byte[] contents)
throws IOException {
final int chopSize = 6 * 1024;
if (contents.length >= bytebuf.capacity()) {
List<byte[]> chops = PnmlExport.chopBytes(contents, chopSize);
for (byte[] buf : chops) {
bytebuf.put(buf);
bytebuf.flip();
fc.write(bytebuf);
bytebuf.clear();
}
} else {
bytebuf.put(contents);
bytebuf.flip();
fc.write(bytebuf);
bytebuf.clear();
}
} | static final void function(final ByteBuffer bytebuf, final FileChannel fc, final byte[] contents) throws IOException { final int chopSize = 6 * 1024; if (contents.length >= bytebuf.capacity()) { List<byte[]> chops = PnmlExport.chopBytes(contents, chopSize); for (byte[] buf : chops) { bytebuf.put(buf); bytebuf.flip(); fc.write(bytebuf); bytebuf.clear(); } } else { bytebuf.put(contents); bytebuf.flip(); fc.write(bytebuf); bytebuf.clear(); } } | /**
* Writes buffer of a given max size into file channel.
*/ | Writes buffer of a given max size into file channel | writeIntoStream | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PTNet/src/fr/lip6/move/pnml/ptnet/impl/ArcImpl.java",
"license": "epl-1.0",
"size": 23727
} | [
"fr.lip6.move.pnml.framework.general.PnmlExport",
"java.io.IOException",
"java.nio.ByteBuffer",
"java.nio.channels.FileChannel",
"java.util.List"
] | import fr.lip6.move.pnml.framework.general.PnmlExport; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.List; | import fr.lip6.move.pnml.framework.general.*; import java.io.*; import java.nio.*; import java.nio.channels.*; import java.util.*; | [
"fr.lip6.move",
"java.io",
"java.nio",
"java.util"
] | fr.lip6.move; java.io; java.nio; java.util; | 983,137 |
public static Path getRegionDir(final Path rootdir, final HRegionInfo info) {
return new Path(
HTableDescriptor.getTableDir(rootdir, info.getTableName()),
info.getEncodedName());
} | static Path function(final Path rootdir, final HRegionInfo info) { return new Path( HTableDescriptor.getTableDir(rootdir, info.getTableName()), info.getEncodedName()); } | /**
* Computes the Path of the HRegion
*
* @param rootdir qualified path of HBase root directory
* @param info HRegionInfo for the region
* @return qualified path of region directory
*/ | Computes the Path of the HRegion | getRegionDir | {
"repo_name": "zqxjjj/NobidaBase",
"path": "src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 219517
} | [
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.HTableDescriptor"
] | import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; | import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,514,651 |
private TaskComponent getTaskComponent(String engineId)
{
TaskComponent component = registry.getTaskComponent(engineId);
if (component == null) { throw new WorkflowException("Task Component for engine id '" + engineId
+ "' is not registered"); }
return component;
} | TaskComponent function(String engineId) { TaskComponent component = registry.getTaskComponent(engineId); if (component == null) { throw new WorkflowException(STR + engineId + STR); } return component; } | /**
* Gets the Task Component registered against the specified BPM Engine Id
*
* @param engineId engine id
*/ | Gets the Task Component registered against the specified BPM Engine Id | getTaskComponent | {
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/workflow/WorkflowServiceImpl.java",
"license": "lgpl-3.0",
"size": 52714
} | [
"org.alfresco.service.cmr.workflow.WorkflowException"
] | import org.alfresco.service.cmr.workflow.WorkflowException; | import org.alfresco.service.cmr.workflow.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 2,625,039 |
void registerSubCommand(@NotNull MinepacksCommand command); | void registerSubCommand(@NotNull MinepacksCommand command); | /**
* Registers a new sub-command for /backpack.
* This function is only available if the plugin is not running in standalone mode!
*
* @param command The command that should be registered.
*/ | Registers a new sub-command for /backpack. This function is only available if the plugin is not running in standalone mode | registerSubCommand | {
"repo_name": "GeorgH93/Minepacks",
"path": "Minepacks-API/src/at/pcgamingfreaks/Minepacks/Bukkit/API/MinepacksCommandManager.java",
"license": "gpl-3.0",
"size": 1405
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,804,545 |
public String addEnvironment(String envName, String type, String value)
throws MalformedObjectNameException {
NamingResourcesImpl nresources = (NamingResourcesImpl) this.resource;
if (nresources == null) {
return null;
}
ContextEnvironment env = nresources.findEnvironment(envName);
if (env != null) {
throw new IllegalArgumentException
("Invalid environment name - already exists '" + envName + "'");
}
env = new ContextEnvironment();
env.setName(envName);
env.setType(type);
env.setValue(value);
nresources.addEnvironment(env);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("ContextEnvironment");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), env);
return (oname.toString());
}
| String function(String envName, String type, String value) throws MalformedObjectNameException { NamingResourcesImpl nresources = (NamingResourcesImpl) this.resource; if (nresources == null) { return null; } ContextEnvironment env = nresources.findEnvironment(envName); if (env != null) { throw new IllegalArgumentException (STR + envName + "'"); } env = new ContextEnvironment(); env.setName(envName); env.setType(type); env.setValue(value); nresources.addEnvironment(env); ManagedBean managed = registry.findManagedBean(STR); ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), env); return (oname.toString()); } | /**
* Add an environment entry for this web application.
*
* @param envName New environment entry name
* @param type The type of the new environment entry
* @param value The value of the new environment entry
* @return the object name of the new environment entry
* @throws MalformedObjectNameException if the object name was invalid
*/ | Add an environment entry for this web application | addEnvironment | {
"repo_name": "IAMTJW/Tomcat-8.5.20",
"path": "tomcat-8.5.20/java/org/apache/catalina/mbeans/NamingResourcesMBean.java",
"license": "apache-2.0",
"size": 12102
} | [
"javax.management.MalformedObjectNameException",
"javax.management.ObjectName",
"org.apache.catalina.deploy.NamingResourcesImpl",
"org.apache.tomcat.util.descriptor.web.ContextEnvironment",
"org.apache.tomcat.util.modeler.ManagedBean"
] | import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.catalina.deploy.NamingResourcesImpl; import org.apache.tomcat.util.descriptor.web.ContextEnvironment; import org.apache.tomcat.util.modeler.ManagedBean; | import javax.management.*; import org.apache.catalina.deploy.*; import org.apache.tomcat.util.descriptor.web.*; import org.apache.tomcat.util.modeler.*; | [
"javax.management",
"org.apache.catalina",
"org.apache.tomcat"
] | javax.management; org.apache.catalina; org.apache.tomcat; | 162,183 |
protected final Boolean isLimitedByClientCredentials() {
return clientType.equals(ClientType.ClientCredentials)
&& tokenScope.equals(getRegularScope());
} | final Boolean function() { return clientType.equals(ClientType.ClientCredentials) && tokenScope.equals(getRegularScope()); } | /**
* Return true if the current test parameters indicate a Client
* Credentials-based client without any admin credentials. These types of
* clients have no identity assigned to them, and therefore cannot 'own'
* any resources which they could then access.
*
* @return True if this is a Client Credentials client without admin scope.
*/ | Return true if the current test parameters indicate a Client Credentials-based client without any admin credentials. These types of clients have no identity assigned to them, and therefore cannot 'own' any resources which they could then access | isLimitedByClientCredentials | {
"repo_name": "kangaroo-server/kangaroo",
"path": "kangaroo-server-authz/src/test/java/net/krotscheck/kangaroo/authz/admin/v1/resource/AbstractServiceSearchTest.java",
"license": "apache-2.0",
"size": 20566
} | [
"net.krotscheck.kangaroo.authz.common.database.entity.ClientType"
] | import net.krotscheck.kangaroo.authz.common.database.entity.ClientType; | import net.krotscheck.kangaroo.authz.common.database.entity.*; | [
"net.krotscheck.kangaroo"
] | net.krotscheck.kangaroo; | 2,555,574 |
public void setSelectorDrawable(int res) {
mViewBehind.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res));
} | void function(int res) { mViewBehind.setSelectorBitmap(BitmapFactory.decodeResource(getResources(), res)); } | /**
* Sets the selector drawable.
*
* @param res a resource ID for the selector drawable
*/ | Sets the selector drawable | setSelectorDrawable | {
"repo_name": "DigDream/Ta-s-book-Android",
"path": "library-slidingmenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "gpl-2.0",
"size": 29409
} | [
"android.graphics.BitmapFactory"
] | import android.graphics.BitmapFactory; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,327,875 |
Map getLsReqList(); | Map getLsReqList(); | /**
* Gets the LS request list.
*
* @return LS request list
*/ | Gets the LS request list | getLsReqList | {
"repo_name": "oplinkoms/onos",
"path": "protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfNbr.java",
"license": "apache-2.0",
"size": 4923
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 916,167 |
return INSTANCE;
}
protected SwapFixedCompoundingONCompoundingDiscountingMethod() {
}
protected static final AnnuityDiscountingMethod METHOD_ANNUITY = AnnuityDiscountingMethod.getInstance();
private static final CouponONCompoundedDiscountingMethod METHOD_COUPON_ON_CMP = CouponONCompoundedDiscountingMethod.getInstance(); | return INSTANCE; } protected SwapFixedCompoundingONCompoundingDiscountingMethod() { } protected static final AnnuityDiscountingMethod METHOD_ANNUITY = AnnuityDiscountingMethod.getInstance(); private static final CouponONCompoundedDiscountingMethod METHOD_COUPON_ON_CMP = CouponONCompoundedDiscountingMethod.getInstance(); | /**
* Return the unique instance of the class.
* @return The instance.
*/ | Return the unique instance of the class | getInstance | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/interestrate/swap/method/SwapFixedCompoundingONCompoundingDiscountingMethod.java",
"license": "apache-2.0",
"size": 21260
} | [
"com.opengamma.analytics.financial.interestrate.annuity.method.AnnuityDiscountingMethod",
"com.opengamma.analytics.financial.interestrate.payments.method.CouponONCompoundedDiscountingMethod"
] | import com.opengamma.analytics.financial.interestrate.annuity.method.AnnuityDiscountingMethod; import com.opengamma.analytics.financial.interestrate.payments.method.CouponONCompoundedDiscountingMethod; | import com.opengamma.analytics.financial.interestrate.annuity.method.*; import com.opengamma.analytics.financial.interestrate.payments.method.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 2,770,466 |
public byte[] getRegionDirect(Integer size, Long offset, byte[] buffer)
throws IOException; | byte[] function(Integer size, Long offset, byte[] buffer) throws IOException; | /**
* Retrieves a region from this pixel buffer directly.
* @param size byte width of the region to retrieve.
* @param offset offset within the pixel buffer.
* @param buffer pre-allocated buffer of the row's size.
* @return <code>buffer</code> containing the data which comprises this
* region. It is guaranteed that this buffer will have been byte
* swapped. <b>The buffer is essentially directly from disk.</b>
* @throws IOException if there is a problem reading from the pixel buffer.
* @see #getRegion(Integer, Long)
*/ | Retrieves a region from this pixel buffer directly | getRegionDirect | {
"repo_name": "knabar/openmicroscopy",
"path": "components/romio/src/ome/io/nio/PixelBuffer.java",
"license": "gpl-2.0",
"size": 33868
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 754,196 |
public ServiceRefType<InterceptorType<T>> createServiceRef()
{
return new ServiceRefTypeImpl<InterceptorType<T>>(this, "service-ref", childNode);
} | ServiceRefType<InterceptorType<T>> function() { return new ServiceRefTypeImpl<InterceptorType<T>>(this, STR, childNode); } | /**
* Creates a new <code>service-ref</code> element
* @return the new created instance of <code>ServiceRefType<InterceptorType<T>></code>
*/ | Creates a new <code>service-ref</code> element | createServiceRef | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar32/InterceptorTypeImpl.java",
"license": "epl-1.0",
"size": 60039
} | [
"org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType",
"org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient14.ServiceRefType",
"org.jboss.shrinkwrap.descriptor.impl.javaeewebservicesclient14.ServiceRefTypeImpl"
] | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient14.ServiceRefType; import org.jboss.shrinkwrap.descriptor.impl.javaeewebservicesclient14.ServiceRefTypeImpl; | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.*; import org.jboss.shrinkwrap.descriptor.api.javaeewebservicesclient14.*; import org.jboss.shrinkwrap.descriptor.impl.javaeewebservicesclient14.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,413,926 |
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
} | int function(ItemStack par1ItemStack) { return 72000; } | /**
* How long it takes to use or consume an item
*/ | How long it takes to use or consume an item | getMaxItemUseDuration | {
"repo_name": "GhostMonk3408/MidgarCrusade",
"path": "src/main/java/fr/toss/FF7Weapons/Silvercannon.java",
"license": "lgpl-2.1",
"size": 3481
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,320,808 |
static boolean loggerFrameworkFullyConfigured()
{
if ( LogManager.getRootLogger().getAllAppenders().hasMoreElements() )
{
return true;
}
List<Logger> loggers = getCurrentLoggers();
for ( Logger logger : loggers )
{
if ( logger.getAllAppenders().hasMoreElements() )
{
// at least one appender found
return true;
}
}
return false;
}
| static boolean loggerFrameworkFullyConfigured() { if ( LogManager.getRootLogger().getAllAppenders().hasMoreElements() ) { return true; } List<Logger> loggers = getCurrentLoggers(); for ( Logger logger : loggers ) { if ( logger.getAllAppenders().hasMoreElements() ) { return true; } } return false; } | /**
* Tests if the logger is configured. Returns <code>true</code>
* if there is at least one appender found.
* <p>
* Since this method loads itself the LogManager it is ensured that it executes its built in
* auto-configuration (unless not yet done before).
* <p>
* @return <code>true</code> if at least one appender is configured.
*/ | Tests if the logger is configured. Returns <code>true</code> if there is at least one appender found. Since this method loads itself the LogManager it is ensured that it executes its built in auto-configuration (unless not yet done before). | loggerFrameworkFullyConfigured | {
"repo_name": "AdnaneKhan/1699_deliv4",
"path": "src/main/java/net/jforum/util/log/LoggerHelper.java",
"license": "bsd-3-clause",
"size": 10089
} | [
"java.util.List",
"org.apache.log4j.LogManager",
"org.apache.log4j.Logger"
] | import java.util.List; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; | import java.util.*; import org.apache.log4j.*; | [
"java.util",
"org.apache.log4j"
] | java.util; org.apache.log4j; | 2,011,058 |
@Override
public boolean doPreAuthenticate(String userName, Object credential,
UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
// Top level try and finally blocks are used to unset thread local variables
try {
if (!IdentityUtil.threadLocalProperties.get().containsKey(DO_PRE_AUTHENTICATE)) {
IdentityUtil.threadLocalProperties.get().put(DO_PRE_AUTHENTICATE, true);
if (log.isDebugEnabled()) {
log.debug("Pre authenticator is called in IdentityMgtEventListener");
}
IdentityUtil.clearIdentityErrorMsg();
IdentityMgtConfig config = IdentityMgtConfig.getInstance();
if (!config.isEnableAuthPolicy()) {
return true;
}
String domainName = userStoreManager.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
String usernameWithDomain = UserCoreUtil.addDomainToName(userName, domainName);
boolean isUserExistInCurrentDomain = userStoreManager.isExistingUser(usernameWithDomain);
if (!isUserExistInCurrentDomain) {
IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext(UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST);
IdentityUtil.setIdentityErrorMsg(customErrorMessageContext);
if (log.isDebugEnabled()) {
log.debug("Username :" + userName + "does not exists in the system, ErrorCode :" + UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST);
}
if (config.isAuthPolicyAccountExistCheck()) {
throw new UserStoreException(UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST);
}
} else {
UserIdentityClaimsDO userIdentityDTO = module.load(userName, userStoreManager);
if (userIdentityDTO == null) {
return true;
}
//If account is disabled, user should not be able to log in
if (userIdentityDTO.getIsAccountDisabled()) {
IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext(
IdentityCoreConstants.USER_ACCOUNT_DISABLED);
IdentityUtil.setIdentityErrorMsg(customErrorMessageContext);
String errorMsg = "User account is disabled for user : " + userName;
log.warn(errorMsg);
throw new UserStoreException(IdentityCoreConstants.USER_ACCOUNT_DISABLED_ERROR_CODE + " "
+ errorMsg);
}
// if the account is locked, should not be able to log in
if (userIdentityDTO.isAccountLocked()) {
// If unlock time is specified then unlock the account.
if ((userIdentityDTO.getUnlockTime() != 0) && (System.currentTimeMillis() >= userIdentityDTO.getUnlockTime())) {
userIdentityDTO.setAccountLock(false);
userIdentityDTO.setUnlockTime(0);
try {
module.store(userIdentityDTO, userStoreManager);
} catch (IdentityException e) {
throw new UserStoreException(
"Error while saving user store data for user : "
+ userName, e);
}
} else {
IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext(
UserCoreConstants.ErrorCode.USER_IS_LOCKED,
userIdentityDTO.getFailAttempts(),
config.getAuthPolicyMaxLoginAttempts());
IdentityUtil.setIdentityErrorMsg(customErrorMessageContext);
String errorMsg = "User account is locked for user : " + userName
+ ". cannot login until the account is unlocked ";
log.warn(errorMsg);
throw new UserStoreException(UserCoreConstants.ErrorCode.USER_IS_LOCKED + " "
+ errorMsg);
}
}
}
}
return true;
} finally {
// remove thread local variable
IdentityUtil.threadLocalProperties.get().remove(DO_PRE_AUTHENTICATE);
}
} | boolean function(String userName, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } try { if (!IdentityUtil.threadLocalProperties.get().containsKey(DO_PRE_AUTHENTICATE)) { IdentityUtil.threadLocalProperties.get().put(DO_PRE_AUTHENTICATE, true); if (log.isDebugEnabled()) { log.debug(STR); } IdentityUtil.clearIdentityErrorMsg(); IdentityMgtConfig config = IdentityMgtConfig.getInstance(); if (!config.isEnableAuthPolicy()) { return true; } String domainName = userStoreManager.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); String usernameWithDomain = UserCoreUtil.addDomainToName(userName, domainName); boolean isUserExistInCurrentDomain = userStoreManager.isExistingUser(usernameWithDomain); if (!isUserExistInCurrentDomain) { IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext(UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST); IdentityUtil.setIdentityErrorMsg(customErrorMessageContext); if (log.isDebugEnabled()) { log.debug(STR + userName + STR + UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST); } if (config.isAuthPolicyAccountExistCheck()) { throw new UserStoreException(UserCoreConstants.ErrorCode.USER_DOES_NOT_EXIST); } } else { UserIdentityClaimsDO userIdentityDTO = module.load(userName, userStoreManager); if (userIdentityDTO == null) { return true; } if (userIdentityDTO.getIsAccountDisabled()) { IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext( IdentityCoreConstants.USER_ACCOUNT_DISABLED); IdentityUtil.setIdentityErrorMsg(customErrorMessageContext); String errorMsg = STR + userName; log.warn(errorMsg); throw new UserStoreException(IdentityCoreConstants.USER_ACCOUNT_DISABLED_ERROR_CODE + " " + errorMsg); } if (userIdentityDTO.isAccountLocked()) { if ((userIdentityDTO.getUnlockTime() != 0) && (System.currentTimeMillis() >= userIdentityDTO.getUnlockTime())) { userIdentityDTO.setAccountLock(false); userIdentityDTO.setUnlockTime(0); try { module.store(userIdentityDTO, userStoreManager); } catch (IdentityException e) { throw new UserStoreException( STR + userName, e); } } else { IdentityErrorMsgContext customErrorMessageContext = new IdentityErrorMsgContext( UserCoreConstants.ErrorCode.USER_IS_LOCKED, userIdentityDTO.getFailAttempts(), config.getAuthPolicyMaxLoginAttempts()); IdentityUtil.setIdentityErrorMsg(customErrorMessageContext); String errorMsg = STR + userName + STR; log.warn(errorMsg); throw new UserStoreException(UserCoreConstants.ErrorCode.USER_IS_LOCKED + " " + errorMsg); } } } } return true; } finally { IdentityUtil.threadLocalProperties.get().remove(DO_PRE_AUTHENTICATE); } } | /**
* This method checks if the user account exist or is locked. If the account is
* locked, the authentication process will be terminated after this method
* returning false.
*/ | This method checks if the user account exist or is locked. If the account is locked, the authentication process will be terminated after this method returning false | doPreAuthenticate | {
"repo_name": "PasinduTennage/carbon-identity-framework",
"path": "components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/IdentityMgtEventListener.java",
"license": "apache-2.0",
"size": 56540
} | [
"org.wso2.carbon.identity.base.IdentityException",
"org.wso2.carbon.identity.core.model.IdentityErrorMsgContext",
"org.wso2.carbon.identity.core.util.IdentityCoreConstants",
"org.wso2.carbon.identity.core.util.IdentityUtil",
"org.wso2.carbon.identity.mgt.dto.UserIdentityClaimsDO",
"org.wso2.carbon.user.core.UserCoreConstants",
"org.wso2.carbon.user.core.UserStoreException",
"org.wso2.carbon.user.core.UserStoreManager",
"org.wso2.carbon.user.core.util.UserCoreUtil"
] | import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.core.model.IdentityErrorMsgContext; import org.wso2.carbon.identity.core.util.IdentityCoreConstants; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.identity.mgt.dto.UserIdentityClaimsDO; import org.wso2.carbon.user.core.UserCoreConstants; import org.wso2.carbon.user.core.UserStoreException; import org.wso2.carbon.user.core.UserStoreManager; import org.wso2.carbon.user.core.util.UserCoreUtil; | import org.wso2.carbon.identity.base.*; import org.wso2.carbon.identity.core.model.*; import org.wso2.carbon.identity.core.util.*; import org.wso2.carbon.identity.mgt.dto.*; import org.wso2.carbon.user.core.*; import org.wso2.carbon.user.core.util.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 1,711,384 |
public FetchData fetchData(long fetchStart, long fetchEnd) {
return fetchData(ConsolFun.AVERAGE, fetchStart, fetchEnd, 1);
} | FetchData function(long fetchStart, long fetchEnd) { return fetchData(ConsolFun.AVERAGE, fetchStart, fetchEnd, 1); } | /**
* Return the probe data for the given period
*
* @param fetchStart
* Starting timestamp for fetch request.
* @param fetchEnd
* Ending timestamp for fetch request.
* @return Request object that should be used to actually fetch data from
* RRD
*/ | Return the probe data for the given period | fetchData | {
"repo_name": "springlin2012/Mycat-Web",
"path": "src/main/java/jrds/Probe.java",
"license": "apache-2.0",
"size": 23780
} | [
"org.rrd4j.ConsolFun",
"org.rrd4j.core.FetchData"
] | import org.rrd4j.ConsolFun; import org.rrd4j.core.FetchData; | import org.rrd4j.*; import org.rrd4j.core.*; | [
"org.rrd4j",
"org.rrd4j.core"
] | org.rrd4j; org.rrd4j.core; | 2,669,588 |
private void handleSourceNotification(Matcher m, String resp) {
if (m == null) {
throw new IllegalArgumentException("m (matcher) cannot be null");
}
if (m.groupCount() == 3) {
try {
final int notifySource = Integer.parseInt(m.group(1));
if (notifySource != source) {
return;
}
final String key = m.group(2).toLowerCase();
final String value = m.group(3);
switch (key) {
case SRC_NAME:
stateChanged(RioConstants.CHANNEL_SOURCENAME, new StringType(value));
break;
case SRC_TYPE:
stateChanged(RioConstants.CHANNEL_SOURCETYPE, new StringType(value));
break;
case SRC_IPADDRESS:
setProperty(RioConstants.PROPERTY_SOURCEIPADDRESS, value);
break;
case SRC_COMPOSERNAME:
stateChanged(RioConstants.CHANNEL_SOURCECOMPOSERNAME, new StringType(value));
break;
case SRC_CHANNEL:
stateChanged(RioConstants.CHANNEL_SOURCECHANNEL, new StringType(value));
break;
case SRC_CHANNELNAME:
stateChanged(RioConstants.CHANNEL_SOURCECHANNELNAME, new StringType(value));
break;
case SRC_GENRE:
stateChanged(RioConstants.CHANNEL_SOURCEGENRE, new StringType(value));
break;
case SRC_ARTISTNAME:
stateChanged(RioConstants.CHANNEL_SOURCEARTISTNAME, new StringType(value));
break;
case SRC_ALBUMNAME:
stateChanged(RioConstants.CHANNEL_SOURCEALBUMNAME, new StringType(value));
break;
case SRC_COVERARTURL:
stateChanged(RioConstants.CHANNEL_SOURCECOVERARTURL, new StringType(value));
break;
case SRC_PLAYLISTNAME:
stateChanged(RioConstants.CHANNEL_SOURCEPLAYLISTNAME, new StringType(value));
break;
case SRC_SONGNAME:
stateChanged(RioConstants.CHANNEL_SOURCESONGNAME, new StringType(value));
break;
case SRC_MODE:
stateChanged(RioConstants.CHANNEL_SOURCEMODE, new StringType(value));
break;
case SRC_SHUFFLEMODE:
stateChanged(RioConstants.CHANNEL_SOURCESHUFFLEMODE, new StringType(value));
break;
case SRC_REPEATMODE:
stateChanged(RioConstants.CHANNEL_SOURCEREPEATMODE, new StringType(value));
break;
case SRC_RATING:
stateChanged(RioConstants.CHANNEL_SOURCERATING, new StringType(value));
break;
case SRC_PROGRAMSERVICENAME:
stateChanged(RioConstants.CHANNEL_SOURCEPROGRAMSERVICENAME, new StringType(value));
break;
case SRC_RADIOTEXT:
stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT, new StringType(value));
break;
case SRC_RADIOTEXT2:
stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT2, new StringType(value));
break;
case SRC_RADIOTEXT3:
stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT3, new StringType(value));
break;
case SRC_RADIOTEXT4:
stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT4, new StringType(value));
break;
case SRC_VOLUME:
stateChanged(RioConstants.CHANNEL_SOURCEVOLUME, new StringType(value));
break;
case SRC_MMSCREEN:
handleMMChange(RioConstants.CHANNEL_SOURCEMMSCREEN, value);
break;
case SRC_MMTITLE:
handleMMChange(RioConstants.CHANNEL_SOURCEMMTITLE, value);
break;
case SRC_MMATTR:
handleMMChange(RioConstants.CHANNEL_SOURCEMMATTR, value);
break;
case SRC_MMBTNOK:
handleMMChange(RioConstants.CHANNEL_SOURCEMMBUTTONOKTEXT, value);
break;
case SRC_MMBTNBACK:
handleMMChange(RioConstants.CHANNEL_SOURCEMMBUTTONBACKTEXT, value);
break;
case SRC_MMHELP:
handleMMChange(RioConstants.CHANNEL_SOURCEMMHELPTEXT, value);
break;
case SRC_MMTEXTFIELD:
handleMMChange(RioConstants.CHANNEL_SOURCEMMTEXTFIELD, value);
break;
case SRC_MMINFOBLOCK:
handleMMChange(RioConstants.CHANNEL_SOURCEMMINFOTEXT, value);
break;
default:
logger.warn("Unknown source notification: '{}'", resp);
break;
}
} catch (NumberFormatException e) {
logger.warn("Invalid Source Notification (source not a parsable integer): '{}')", resp);
}
} else {
logger.warn("Invalid Source Notification response: '{}'", resp);
}
} | void function(Matcher m, String resp) { if (m == null) { throw new IllegalArgumentException(STR); } if (m.groupCount() == 3) { try { final int notifySource = Integer.parseInt(m.group(1)); if (notifySource != source) { return; } final String key = m.group(2).toLowerCase(); final String value = m.group(3); switch (key) { case SRC_NAME: stateChanged(RioConstants.CHANNEL_SOURCENAME, new StringType(value)); break; case SRC_TYPE: stateChanged(RioConstants.CHANNEL_SOURCETYPE, new StringType(value)); break; case SRC_IPADDRESS: setProperty(RioConstants.PROPERTY_SOURCEIPADDRESS, value); break; case SRC_COMPOSERNAME: stateChanged(RioConstants.CHANNEL_SOURCECOMPOSERNAME, new StringType(value)); break; case SRC_CHANNEL: stateChanged(RioConstants.CHANNEL_SOURCECHANNEL, new StringType(value)); break; case SRC_CHANNELNAME: stateChanged(RioConstants.CHANNEL_SOURCECHANNELNAME, new StringType(value)); break; case SRC_GENRE: stateChanged(RioConstants.CHANNEL_SOURCEGENRE, new StringType(value)); break; case SRC_ARTISTNAME: stateChanged(RioConstants.CHANNEL_SOURCEARTISTNAME, new StringType(value)); break; case SRC_ALBUMNAME: stateChanged(RioConstants.CHANNEL_SOURCEALBUMNAME, new StringType(value)); break; case SRC_COVERARTURL: stateChanged(RioConstants.CHANNEL_SOURCECOVERARTURL, new StringType(value)); break; case SRC_PLAYLISTNAME: stateChanged(RioConstants.CHANNEL_SOURCEPLAYLISTNAME, new StringType(value)); break; case SRC_SONGNAME: stateChanged(RioConstants.CHANNEL_SOURCESONGNAME, new StringType(value)); break; case SRC_MODE: stateChanged(RioConstants.CHANNEL_SOURCEMODE, new StringType(value)); break; case SRC_SHUFFLEMODE: stateChanged(RioConstants.CHANNEL_SOURCESHUFFLEMODE, new StringType(value)); break; case SRC_REPEATMODE: stateChanged(RioConstants.CHANNEL_SOURCEREPEATMODE, new StringType(value)); break; case SRC_RATING: stateChanged(RioConstants.CHANNEL_SOURCERATING, new StringType(value)); break; case SRC_PROGRAMSERVICENAME: stateChanged(RioConstants.CHANNEL_SOURCEPROGRAMSERVICENAME, new StringType(value)); break; case SRC_RADIOTEXT: stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT, new StringType(value)); break; case SRC_RADIOTEXT2: stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT2, new StringType(value)); break; case SRC_RADIOTEXT3: stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT3, new StringType(value)); break; case SRC_RADIOTEXT4: stateChanged(RioConstants.CHANNEL_SOURCERADIOTEXT4, new StringType(value)); break; case SRC_VOLUME: stateChanged(RioConstants.CHANNEL_SOURCEVOLUME, new StringType(value)); break; case SRC_MMSCREEN: handleMMChange(RioConstants.CHANNEL_SOURCEMMSCREEN, value); break; case SRC_MMTITLE: handleMMChange(RioConstants.CHANNEL_SOURCEMMTITLE, value); break; case SRC_MMATTR: handleMMChange(RioConstants.CHANNEL_SOURCEMMATTR, value); break; case SRC_MMBTNOK: handleMMChange(RioConstants.CHANNEL_SOURCEMMBUTTONOKTEXT, value); break; case SRC_MMBTNBACK: handleMMChange(RioConstants.CHANNEL_SOURCEMMBUTTONBACKTEXT, value); break; case SRC_MMHELP: handleMMChange(RioConstants.CHANNEL_SOURCEMMHELPTEXT, value); break; case SRC_MMTEXTFIELD: handleMMChange(RioConstants.CHANNEL_SOURCEMMTEXTFIELD, value); break; case SRC_MMINFOBLOCK: handleMMChange(RioConstants.CHANNEL_SOURCEMMINFOTEXT, value); break; default: logger.warn(STR, resp); break; } } catch (NumberFormatException e) { logger.warn(STR, resp); } } else { logger.warn(STR, resp); } } | /**
* Handles any source notifications returned by the russound system
*
* @param m a non-null matcher
* @param resp a possibly null, possibly empty response
*/ | Handles any source notifications returned by the russound system | handleSourceNotification | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/source/RioSourceProtocol.java",
"license": "epl-1.0",
"size": 26401
} | [
"java.util.regex.Matcher",
"org.openhab.binding.russound.internal.rio.RioConstants",
"org.openhab.core.library.types.StringType"
] | import java.util.regex.Matcher; import org.openhab.binding.russound.internal.rio.RioConstants; import org.openhab.core.library.types.StringType; | import java.util.regex.*; import org.openhab.binding.russound.internal.rio.*; import org.openhab.core.library.types.*; | [
"java.util",
"org.openhab.binding",
"org.openhab.core"
] | java.util; org.openhab.binding; org.openhab.core; | 2,597,421 |
public void addAll(Collection<ModuleInternalInfo> configInfos) {
if (!currentConfig.isEmpty()) {
throw new IllegalStateException(
"Error - some config entries were not removed: "
+ currentConfig);
}
for (ModuleInternalInfo configInfo : configInfos) {
add(configInfo);
}
} | void function(Collection<ModuleInternalInfo> configInfos) { if (!currentConfig.isEmpty()) { throw new IllegalStateException( STR + currentConfig); } for (ModuleInternalInfo configInfo : configInfos) { add(configInfo); } } | /**
* Add all modules to the internal map. Also add service instance to OSGi
* Service Registry.
*/ | Add all modules to the internal map. Also add service instance to OSGi Service Registry | addAll | {
"repo_name": "qqbbyq/controller",
"path": "opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ConfigRegistryImpl.java",
"license": "epl-1.0",
"size": 34785
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,721,933 |
public boolean isContactBookAccessAllowed() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS));
} else {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
return preferences.getBoolean(CONTACTS_BOOK_ACCESS_KEY, false);
}
} | boolean function() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS)); } else { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); return preferences.getBoolean(CONTACTS_BOOK_ACCESS_KEY, false); } } | /**
* Tells if the contacts book access has been granted
*
* @return true if it was granted.
*/ | Tells if the contacts book access has been granted | isContactBookAccessAllowed | {
"repo_name": "vector-im/vector-android",
"path": "vector/src/main/java/im/vector/contacts/ContactsManager.java",
"license": "apache-2.0",
"size": 26033
} | [
"android.content.SharedPreferences",
"android.content.pm.PackageManager",
"android.os.Build",
"androidx.core.content.ContextCompat",
"androidx.preference.PreferenceManager"
] | import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import androidx.core.content.ContextCompat; import androidx.preference.PreferenceManager; | import android.content.*; import android.content.pm.*; import android.os.*; import androidx.core.content.*; import androidx.preference.*; | [
"android.content",
"android.os",
"androidx.core",
"androidx.preference"
] | android.content; android.os; androidx.core; androidx.preference; | 2,544,559 |
public JSONArray history( HashMap<String, Object> args ) {
String channel = (String) args.get("channel");
int limit = Integer.parseInt(args.get("limit").toString());
List<String> url = new ArrayList<String>();
url.add("history");
url.add(this.SUBSCRIBE_KEY);
url.add(channel);
url.add("0");
url.add(Integer.toString(limit));
if (this.CIPHER_KEY.length() > 0) {
// Decrpyt Messages
PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY);
return pc.decryptJSONArray(_request(url));
} else {
return _request(url);
}
}
| JSONArray function( HashMap<String, Object> args ) { String channel = (String) args.get(STR); int limit = Integer.parseInt(args.get("limit").toString()); List<String> url = new ArrayList<String>(); url.add(STR); url.add(this.SUBSCRIBE_KEY); url.add(channel); url.add("0"); url.add(Integer.toString(limit)); if (this.CIPHER_KEY.length() > 0) { PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); return pc.decryptJSONArray(_request(url)); } else { return _request(url); } } | /**
* History
*
* Load history from a channel.
*
* @param HashMap<String, Object> containing channel name, limit history count response.
* @return JSONArray of history.
*/ | History Load history from a channel | history | {
"repo_name": "jamesward/pubnub-api",
"path": "java/src/main/java/pubnub/Pubnub.java",
"license": "mit",
"size": 22366
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"org.json.JSONArray"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; | import java.util.*; import org.json.*; | [
"java.util",
"org.json"
] | java.util; org.json; | 2,445,719 |
private Image getImage(Control control) {
if (fImage == null) {
fImage= createImage(control.getDisplay(), control.getSize()); | Image function(Control control) { if (fImage == null) { fImage= createImage(control.getDisplay(), control.getSize()); | /**
* Returns the image of this range indicator.
*
* @param control the control
* @return an image
*/ | Returns the image of this range indicator | getImage | {
"repo_name": "xiaguangme/simon_ide_tools",
"path": "02.eclipse_enhance/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java",
"license": "apache-2.0",
"size": 4779
} | [
"org.eclipse.swt.graphics.Image",
"org.eclipse.swt.widgets.Control"
] | import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Control; | import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 631,538 |
@Override
public void windowDeiconified(WindowEvent ev)
{
uploadButtonStatus();
} | void function(WindowEvent ev) { uploadButtonStatus(); } | /**
* Called when the GUI is unminimized.
*
* @param ev
* The WindowEvent associated with the window unminimizing.
*/ | Called when the GUI is unminimized | windowDeiconified | {
"repo_name": "DV8FromTheWorld/Imgur-Uploader-Java",
"path": "src/net/dv8tion/UploaderFrame.java",
"license": "apache-2.0",
"size": 30341
} | [
"java.awt.event.WindowEvent"
] | import java.awt.event.WindowEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,820,951 |
@Override
public Enumeration<Option> listOptions() {
Vector<Option> newVector = new Vector<Option>();
newVector.addElement(new Option(
"\tSet ridge parameter (default 1.0e-8).\n", "R", 1, "-R <double>"));
newVector.addAll(Collections.list(super.listOptions()));
return newVector.elements();
}
| Enumeration<Option> function() { Vector<Option> newVector = new Vector<Option>(); newVector.addElement(new Option( STR, "R", 1, STR)); newVector.addAll(Collections.list(super.listOptions())); return newVector.elements(); } | /**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/ | Returns an enumeration describing the available options | listOptions | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-weka/src/main/java/weka/core/WeightedEuclideanDistanceRidge.java",
"license": "gpl-3.0",
"size": 14325
} | [
"java.util.Collections",
"java.util.Enumeration",
"java.util.Vector"
] | import java.util.Collections; import java.util.Enumeration; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,406,745 |
public ActionForward deleteFandaRate(ActionMapping mapping, ActionForm form
, HttpServletRequest request, HttpServletResponse response) throws Exception {
AwardForm awardForm = (AwardForm) form;
AwardDocument awardDocument = (AwardDocument) awardForm.getDocument();
deleteFandaRateFromAward(awardDocument.getAward(),getLineToDelete(request));
return mapping.findForward(Constants.MAPPING_AWARD_BASIC);
} | ActionForward function(ActionMapping mapping, ActionForm form , HttpServletRequest request, HttpServletResponse response) throws Exception { AwardForm awardForm = (AwardForm) form; AwardDocument awardDocument = (AwardDocument) awardForm.getDocument(); deleteFandaRateFromAward(awardDocument.getAward(),getLineToDelete(request)); return mapping.findForward(Constants.MAPPING_AWARD_BASIC); } | /**
*
* This method deletes an <code>AwardFandaRate</code> business object from
* the list of <code>AwardFandaRate</code> business objects
* It gets called upon delete action on F&A Rates Sub-Panel of Rates Panel
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/ | This method deletes an <code>AwardFandaRate</code> business object from the list of <code>AwardFandaRate</code> business objects It gets called upon delete action on F&A Rates Sub-Panel of Rates Panel | deleteFandaRate | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/award/web/struts/action/AwardCommitmentsAction.java",
"license": "apache-2.0",
"size": 10359
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping",
"org.kuali.kra.award.AwardForm",
"org.kuali.kra.award.document.AwardDocument",
"org.kuali.kra.infrastructure.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 org.kuali.kra.award.AwardForm; import org.kuali.kra.award.document.AwardDocument; import org.kuali.kra.infrastructure.Constants; | import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kra.award.*; import org.kuali.kra.award.document.*; import org.kuali.kra.infrastructure.*; | [
"javax.servlet",
"org.apache.struts",
"org.kuali.kra"
] | javax.servlet; org.apache.struts; org.kuali.kra; | 2,386,446 |
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
throws Exception
{
try (final BufferedInputStream in = new BufferedInputStream(new FileInputStream(sbeSchemaFilename)))
{
XmlSchemaParser.validate(xsdFilename, in);
}
} | static void function(final String sbeSchemaFilename, final String xsdFilename) throws Exception { try (final BufferedInputStream in = new BufferedInputStream(new FileInputStream(sbeSchemaFilename))) { XmlSchemaParser.validate(xsdFilename, in); } } | /**
* Validate the SBE Schema against the XSD.
*
* @param sbeSchemaFilename to be validated
* @param xsdFilename XSD against which to validate
* @throws Exception if an error occurs while validating
*/ | Validate the SBE Schema against the XSD | validateAgainstSchema | {
"repo_name": "saleyn/simple-binary-encoding",
"path": "main/java/uk/co/real_logic/sbe/SbeTool.java",
"license": "apache-2.0",
"size": 8815
} | [
"java.io.BufferedInputStream",
"java.io.FileInputStream",
"uk.co.real_logic.sbe.xml.XmlSchemaParser"
] | import java.io.BufferedInputStream; import java.io.FileInputStream; import uk.co.real_logic.sbe.xml.XmlSchemaParser; | import java.io.*; import uk.co.real_logic.sbe.xml.*; | [
"java.io",
"uk.co.real_logic"
] | java.io; uk.co.real_logic; | 33,696 |
@Deprecated
public final void onModule(NetworkModule module) {} | final void function(NetworkModule module) {} | /**
* Old-style search extension point. {@code @Deprecated} and {@code final} to act as a signpost for plugin authors upgrading
* from 2.x.
*
* @deprecated implement {@link SearchPlugin} instead
*/ | Old-style search extension point. @Deprecated and final to act as a signpost for plugin authors upgrading from 2.x | onModule | {
"repo_name": "strapdata/elassandra",
"path": "server/src/main/java/org/elasticsearch/plugins/Plugin.java",
"license": "apache-2.0",
"size": 14570
} | [
"org.elasticsearch.common.network.NetworkModule"
] | import org.elasticsearch.common.network.NetworkModule; | import org.elasticsearch.common.network.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 2,454,485 |
private byte[] handshake (BufferedInputStream bis, BufferedOutputStream bos)
throws IOException
{
din = new DataInputStream(bis);
dout = new DataOutputStream(bos);
// Handshake write - header
dout.write(19);
dout.write("BitTorrent protocol".getBytes("UTF-8"));
// Handshake write - zeros
byte[] zeros = new byte[8];
dout.write(zeros);
// Handshake write - metainfo hash
byte[] shared_hash = metainfo.getInfoHash();
dout.write(shared_hash);
// Handshake write - peer id
dout.write(my_id);
dout.flush();
// Handshake read - header
byte b = din.readByte();
if (b != 19) {
throw new IOException("Handshake failure, expected 19, got "
+ (b & 0xff));
}
byte[] bs = new byte[19];
din.readFully(bs);
String bittorrentProtocol = new String(bs, "UTF-8");
if (!"BitTorrent protocol".equals(bittorrentProtocol)) {
throw new IOException("Handshake failure, expected "
+ "'Bittorrent protocol', got '" + bittorrentProtocol + "'");
}
// Handshake read - zeros
din.readFully(zeros);
// Handshake read - metainfo hash
bs = new byte[20];
din.readFully(bs);
if (!Arrays.equals(shared_hash, bs)) {
throw new IOException("Unexpected MetaInfo hash");
}
// Handshake read - peer id
din.readFully(bs);
return bs;
} | byte[] function (BufferedInputStream bis, BufferedOutputStream bos) throws IOException { din = new DataInputStream(bis); dout = new DataOutputStream(bos); dout.write(19); dout.write(STR.getBytes("UTF-8")); byte[] zeros = new byte[8]; dout.write(zeros); byte[] shared_hash = metainfo.getInfoHash(); dout.write(shared_hash); dout.write(my_id); dout.flush(); byte b = din.readByte(); if (b != 19) { throw new IOException(STR + (b & 0xff)); } byte[] bs = new byte[19]; din.readFully(bs); String bittorrentProtocol = new String(bs, "UTF-8"); if (!STR.equals(bittorrentProtocol)) { throw new IOException(STR + STR + bittorrentProtocol + "'"); } din.readFully(zeros); bs = new byte[20]; din.readFully(bs); if (!Arrays.equals(shared_hash, bs)) { throw new IOException(STR); } din.readFully(bs); return bs; } | /**
* Sets DataIn/OutputStreams, does the handshake and returns the id reported
* by the other side.
*/ | Sets DataIn/OutputStreams, does the handshake and returns the id reported by the other side | handshake | {
"repo_name": "pyronicide/snark-maven",
"path": "src/main/java/org/klomp/snark/Peer.java",
"license": "gpl-2.0",
"size": 11463
} | [
"java.io.BufferedInputStream",
"java.io.BufferedOutputStream",
"java.io.DataInputStream",
"java.io.DataOutputStream",
"java.io.IOException",
"java.util.Arrays"
] | import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.Arrays; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 38,434 |
public Set<T> common() {
Set<T> sourceCopy = new HashSet<>(this.sourceSet);
sourceCopy.retainAll(this.destinationSet);
return sourceCopy;
} | Set<T> function() { Set<T> sourceCopy = new HashSet<>(this.sourceSet); sourceCopy.retainAll(this.destinationSet); return sourceCopy; } | /**
* Determines which objects are common to both {@code sourceSet} and
* {@code destinationSet}. That is, all objects that are in both
* {@code sourceSet} and {@code destinationSet}.
*
* @return
*/ | Determines which objects are common to both sourceSet and destinationSet. That is, all objects that are in both sourceSet and destinationSet | common | {
"repo_name": "elastisys/scale.commons",
"path": "util/src/main/java/com/elastisys/scale/commons/util/diff/SetDiff.java",
"license": "apache-2.0",
"size": 2194
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,302,342 |
public FirebaseResponse patch(String path, Map<String, Object> data) throws FirebaseException, JacksonUtilityException, UnsupportedEncodingException {
// make the request
String url = this.buildFullUrlFromRelativePath( path );
//HttpPut request = new HttpPut( url );
HttpPatch request = new HttpPatch(url);
request.setEntity( this.buildEntityFromDataMap( data ) );
HttpResponse httpResponse = this.makeRequest( request );
// process the response
FirebaseResponse response = this.processResponse( FirebaseRestMethod.PATCH, httpResponse );
return response;
}
| FirebaseResponse function(String path, Map<String, Object> data) throws FirebaseException, JacksonUtilityException, UnsupportedEncodingException { String url = this.buildFullUrlFromRelativePath( path ); HttpPatch request = new HttpPatch(url); request.setEntity( this.buildEntityFromDataMap( data ) ); HttpResponse httpResponse = this.makeRequest( request ); FirebaseResponse response = this.processResponse( FirebaseRestMethod.PATCH, httpResponse ); return response; } | /**
* PATCHs data on the provided-path relative to the base-url.
*
* @param path -- if null/empty, refers to the base-url
* @param data -- can be null/empty
* @return {@link FirebaseResponse}
* @throws {@link FirebaseException}
* @throws {@link JacksonUtilityException}
* @throws UnsupportedEncodingException
*/ | PATCHs data on the provided-path relative to the base-url | patch | {
"repo_name": "wmarquesr/NoSQLProject",
"path": "src/net/thegreshams/firebase4j/service/Firebase.java",
"license": "gpl-3.0",
"size": 19648
} | [
"java.io.UnsupportedEncodingException",
"java.util.Map",
"net.thegreshams.firebase4j.error.FirebaseException",
"net.thegreshams.firebase4j.error.JacksonUtilityException",
"net.thegreshams.firebase4j.model.FirebaseResponse",
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpPatch"
] | import java.io.UnsupportedEncodingException; import java.util.Map; import net.thegreshams.firebase4j.error.FirebaseException; import net.thegreshams.firebase4j.error.JacksonUtilityException; import net.thegreshams.firebase4j.model.FirebaseResponse; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPatch; | import java.io.*; import java.util.*; import net.thegreshams.firebase4j.error.*; import net.thegreshams.firebase4j.model.*; import org.apache.http.*; import org.apache.http.client.methods.*; | [
"java.io",
"java.util",
"net.thegreshams.firebase4j",
"org.apache.http"
] | java.io; java.util; net.thegreshams.firebase4j; org.apache.http; | 872,324 |
@Test(expected = ExecutionException.class)
public void testError() throws Exception {
FutureRecordMetadata future = new FutureRecordMetadata(asyncRequest(baseOffset, new CorruptRecordException(), 50L), relOffset);
future.get();
} | @Test(expected = ExecutionException.class) void function() throws Exception { FutureRecordMetadata future = new FutureRecordMetadata(asyncRequest(baseOffset, new CorruptRecordException(), 50L), relOffset); future.get(); } | /**
* Test that an asynchronous request will eventually throw the right exception
*/ | Test that an asynchronous request will eventually throw the right exception | testError | {
"repo_name": "unix1986/universe",
"path": "tool/kafka-0.8.1.1-src/clients/src/test/java/org/apache/kafka/clients/producer/RecordSendTest.java",
"license": "bsd-2-clause",
"size": 3655
} | [
"java.util.concurrent.ExecutionException",
"org.apache.kafka.clients.producer.internals.FutureRecordMetadata",
"org.apache.kafka.common.errors.CorruptRecordException",
"org.junit.Test"
] | import java.util.concurrent.ExecutionException; import org.apache.kafka.clients.producer.internals.FutureRecordMetadata; import org.apache.kafka.common.errors.CorruptRecordException; import org.junit.Test; | import java.util.concurrent.*; import org.apache.kafka.clients.producer.internals.*; import org.apache.kafka.common.errors.*; import org.junit.*; | [
"java.util",
"org.apache.kafka",
"org.junit"
] | java.util; org.apache.kafka; org.junit; | 2,572,276 |
public void setVulnStatusFields(VulnerabilityPojo vuln,
ComponentUsePojo compUse) throws SQLException {
setDefaults(vuln);
addStatus(vuln, compUse);
} | void function(VulnerabilityPojo vuln, ComponentUsePojo compUse) throws SQLException { setDefaults(vuln); addStatus(vuln, compUse); } | /**
* Use this to update on a re-used vulnerability only the fields that are
* use-specific.
*
* @param vuln
* @param compUse
* @throws SQLException
*/ | Use this to update on a re-used vulnerability only the fields that are use-specific | setVulnStatusFields | {
"repo_name": "blackducksoftware/common-framework",
"path": "src/main/java/com/blackducksoftware/tools/commonframework/standard/codecenter/dao/CodeCenter6_6_1DbDao.java",
"license": "apache-2.0",
"size": 20138
} | [
"com.blackducksoftware.tools.commonframework.standard.codecenter.pojo.ComponentUsePojo",
"com.blackducksoftware.tools.commonframework.standard.codecenter.pojo.VulnerabilityPojo",
"java.sql.SQLException"
] | import com.blackducksoftware.tools.commonframework.standard.codecenter.pojo.ComponentUsePojo; import com.blackducksoftware.tools.commonframework.standard.codecenter.pojo.VulnerabilityPojo; import java.sql.SQLException; | import com.blackducksoftware.tools.commonframework.standard.codecenter.pojo.*; import java.sql.*; | [
"com.blackducksoftware.tools",
"java.sql"
] | com.blackducksoftware.tools; java.sql; | 807,564 |
@SuppressWarnings("serial")
@Override
protected void doActivate() {
super.doActivate();
// adding the ChangeListener "objectObserver" to the connected model
getContent().addPropertyChangeListener(objectObserver);
FocusModel<Node> focusModel = getRoot().getViewer().getAdapter(new TypeToken<FocusModel<Node>>() {
});
// adding the focusObserver of type FocusListener to the connected model
focusModel.focusProperty().addListener(focusObserver);
}
| @SuppressWarnings(STR) void function() { super.doActivate(); getContent().addPropertyChangeListener(objectObserver); FocusModel<Node> focusModel = getRoot().getViewer().getAdapter(new TypeToken<FocusModel<Node>>() { }); focusModel.focusProperty().addListener(focusObserver); } | /**
* Implements the post activate() hook for the conrete VariableBlockPart
*/ | Implements the post activate() hook for the conrete VariableBlockPart | doActivate | {
"repo_name": "m-toussaint/SME",
"path": "de.htwberlin.selabs.ssme/src/de/htwberlin/selabs/ssme/parts/VariableBlockPart.java",
"license": "gpl-3.0",
"size": 10109
} | [
"com.google.common.reflect.TypeToken",
"org.eclipse.gef4.mvc.models.FocusModel"
] | import com.google.common.reflect.TypeToken; import org.eclipse.gef4.mvc.models.FocusModel; | import com.google.common.reflect.*; import org.eclipse.gef4.mvc.models.*; | [
"com.google.common",
"org.eclipse.gef4"
] | com.google.common; org.eclipse.gef4; | 2,584,421 |
private void useStar(CalciteSchema schema, Materialization materialization) {
RelNode queryRel = requireNonNull(materialization.queryRel, "materialization.queryRel");
for (Callback x : useStar(schema, queryRel)) {
// Success -- we found a star table that matches.
materialization.materialize(x.rel, x.starRelOptTable);
if (CalciteSystemProperty.DEBUG.value()) {
System.out.println("Materialization "
+ materialization.materializedTable + " matched star table "
+ x.starTable + "; query after re-write: "
+ RelOptUtil.toString(queryRel));
}
}
} | void function(CalciteSchema schema, Materialization materialization) { RelNode queryRel = requireNonNull(materialization.queryRel, STR); for (Callback x : useStar(schema, queryRel)) { materialization.materialize(x.rel, x.starRelOptTable); if (CalciteSystemProperty.DEBUG.value()) { System.out.println(STR + materialization.materializedTable + STR + x.starTable + STR + RelOptUtil.toString(queryRel)); } } } | /** Converts a relational expression to use a
* {@link StarTable} defined in {@code schema}.
* Uses the first star table that fits. */ | Converts a relational expression to use a <code>StarTable</code> defined in schema | useStar | {
"repo_name": "datametica/calcite",
"path": "core/src/main/java/org/apache/calcite/prepare/CalciteMaterializer.java",
"license": "apache-2.0",
"size": 8841
} | [
"java.util.Objects",
"org.apache.calcite.config.CalciteSystemProperty",
"org.apache.calcite.jdbc.CalciteSchema",
"org.apache.calcite.plan.RelOptUtil",
"org.apache.calcite.rel.RelNode"
] | import java.util.Objects; import org.apache.calcite.config.CalciteSystemProperty; import org.apache.calcite.jdbc.CalciteSchema; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.rel.RelNode; | import java.util.*; import org.apache.calcite.config.*; import org.apache.calcite.jdbc.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 40,725 |
public String[] getFieldsToArray()
{
ArrayList<Field> fields = mFields;
int fieldCount = fields.size();
ArrayList<String> aux = new ArrayList<>();
aux.add(DataFramework.KEY_ID);
for (int i = 0; i < fieldCount; i++) {
if (fields.get(i).getType().equals("multilanguage")) {
ArrayList<String> langs = DataFramework.getInstance().getLanguages();
for (int j=0; j<langs.size(); j++) {
aux.add(fields.get(i).getName() + "_" + langs.get(j));
}
} else {
aux.add(fields.get(i).getName());
}
}
String[] out = new String[aux.size()];
for (int i = 0; i < aux.size(); i++) {
out[i] = aux.get(i);
}
return out;
}
| String[] function() { ArrayList<Field> fields = mFields; int fieldCount = fields.size(); ArrayList<String> aux = new ArrayList<>(); aux.add(DataFramework.KEY_ID); for (int i = 0; i < fieldCount; i++) { if (fields.get(i).getType().equals(STR)) { ArrayList<String> langs = DataFramework.getInstance().getLanguages(); for (int j=0; j<langs.size(); j++) { aux.add(fields.get(i).getName() + "_" + langs.get(j)); } } else { aux.add(fields.get(i).getName()); } } String[] out = new String[aux.size()]; for (int i = 0; i < aux.size(); i++) { out[i] = aux.get(i); } return out; } | /**
* Devuelve un array con los nombres de los campos de la tabla
*
* @return array con los nombres
*/ | Devuelve un array con los nombres de los campos de la tabla | getFieldsToArray | {
"repo_name": "romilgildo/SWADroid",
"path": "SWADroid/src/main/java/com/android/dataframework/core/Table.java",
"license": "gpl-3.0",
"size": 6234
} | [
"com.android.dataframework.DataFramework",
"java.util.ArrayList"
] | import com.android.dataframework.DataFramework; import java.util.ArrayList; | import com.android.dataframework.*; import java.util.*; | [
"com.android.dataframework",
"java.util"
] | com.android.dataframework; java.util; | 307,873 |
public void printNetworkInfo(NetworkInfo info, StringBuilder stringBuilder) {
stringBuilder.append("Type=" + info.getTypeName() + "(" + info.getType() + ")\n");
stringBuilder.append("SubType=" + info.getSubtypeName() + "(" + info.getSubtype() + ")\n");
stringBuilder.append("State=" + info.getState().toString() + "\n");
stringBuilder.append("Reason=" + info.getReason() + "\n");
stringBuilder.append("Available=" + info.isAvailable() + "\n");
stringBuilder.append("Connected=" + info.isConnected() + "\n");
stringBuilder.append("Roaming=" + info.isRoaming() + "\n");
stringBuilder.append("Failover=" + info.isFailover() + "\n");
stringBuilder.append("DetailedState=" + info.getDetailedState().toString() + "\n");
stringBuilder.append("ExtraInfo=" + info.getExtraInfo() + "\n");
stringBuilder.append("toString=" + info.toString() + "\n");
} | void function(NetworkInfo info, StringBuilder stringBuilder) { stringBuilder.append("Type=" + info.getTypeName() + "(" + info.getType() + ")\n"); stringBuilder.append(STR + info.getSubtypeName() + "(" + info.getSubtype() + ")\n"); stringBuilder.append(STR + info.getState().toString() + "\n"); stringBuilder.append(STR + info.getReason() + "\n"); stringBuilder.append(STR + info.isAvailable() + "\n"); stringBuilder.append(STR + info.isConnected() + "\n"); stringBuilder.append(STR + info.isRoaming() + "\n"); stringBuilder.append(STR + info.isFailover() + "\n"); stringBuilder.append(STR + info.getDetailedState().toString() + "\n"); stringBuilder.append(STR + info.getExtraInfo() + "\n"); stringBuilder.append(STR + info.toString() + "\n"); } | /**
* Will print the data from the NetworkInfo into the given StringBuilder instance
*
* @param info NetworkInfo object
* @param stringBuilder StringBuilder instance
*/ | Will print the data from the NetworkInfo into the given StringBuilder instance | printNetworkInfo | {
"repo_name": "demantz/WearNetworkNotifications",
"path": "mobile/src/main/java/com/mantz_it/wearnetworknotifications/SettingsActivity.java",
"license": "gpl-2.0",
"size": 22573
} | [
"android.net.NetworkInfo"
] | import android.net.NetworkInfo; | import android.net.*; | [
"android.net"
] | android.net; | 2,787,664 |
public ElementList setElements(final ElementList elements) {
// show an indicator; this might be time consuming
SplashDialog splash = new SplashDialog("Crossdating...");
final ProgressMeter meter = new ProgressMeter(0, 1);
meter.addProgressListener(splash);
// force pop up!
meter.setMillisToDecideToPopup(-1);
meter.setMillisToPopup(-1);
final ElementList el = new ElementList(); // our pre-loaded list.
| ElementList function(final ElementList elements) { SplashDialog splash = new SplashDialog(STR); final ProgressMeter meter = new ProgressMeter(0, 1); meter.addProgressListener(splash); meter.setMillisToDecideToPopup(-1); meter.setMillisToPopup(-1); final ElementList el = new ElementList(); | /**
* Set our internal list of elements to crossdate
* This list should already be pre-loaded, but
* the function will cope if it is not by ignoring
* any load errors.
*
* @param elements a new element list with the proper elements
*/ | Set our internal list of elements to crossdate This list should already be pre-loaded, but the function will cope if it is not by ignoring any load errors | setElements | {
"repo_name": "petebrew/tellervo",
"path": "src/main/java/org/tellervo/desktop/cross/CrossdateCollection.java",
"license": "gpl-3.0",
"size": 6663
} | [
"org.tellervo.desktop.gui.ProgressMeter",
"org.tellervo.desktop.gui.SplashDialog",
"org.tellervo.desktop.sample.ElementList"
] | import org.tellervo.desktop.gui.ProgressMeter; import org.tellervo.desktop.gui.SplashDialog; import org.tellervo.desktop.sample.ElementList; | import org.tellervo.desktop.gui.*; import org.tellervo.desktop.sample.*; | [
"org.tellervo.desktop"
] | org.tellervo.desktop; | 2,010,009 |
public static ViewDragHelper create(ViewGroup forParent, Interpolator interpolator, Callback cb) {
return new ViewDragHelper(forParent.getContext(), forParent, interpolator, cb);
} | static ViewDragHelper function(ViewGroup forParent, Interpolator interpolator, Callback cb) { return new ViewDragHelper(forParent.getContext(), forParent, interpolator, cb); } | /**
* Factory method to create a new ViewDragHelper with the specified interpolator.
*
* @param forParent Parent view to monitor
* @param interpolator interpolator for scroller
* @param cb Callback to provide information and receive events
* @return a new ViewDragHelper instance
*/ | Factory method to create a new ViewDragHelper with the specified interpolator | create | {
"repo_name": "gl-30hacks/gdrivemate",
"path": "library/src/main/java/com/gl/gdrivemate/slidinguppanel/ViewDragHelper.java",
"license": "mit",
"size": 62156
} | [
"android.view.ViewGroup",
"android.view.animation.Interpolator"
] | import android.view.ViewGroup; import android.view.animation.Interpolator; | import android.view.*; import android.view.animation.*; | [
"android.view"
] | android.view; | 985,437 |
public static List<Double> passThroughDfe(final int size,
final List<Double> dataIn) {
List<Double> dataOut = new ArrayList<Double>();
final DecimalFormat timeFormat = new DecimalFormat("#0.00000");
double startTime = System.nanoTime();
// Make socket
TTransport transport = new TSocket("localhost", PORT);
// Wrap in a protocol
TProtocol protocol = new TBinaryProtocol(transport);
// Create a client to use the protocol encoder
PassThroughService.Client client =
new PassThroughService.Client(protocol);
double estimatedTime = (System.nanoTime() - startTime)
/ NUM_OF_NANO_SECONDS;
System.out.println("Creating a client:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
try {
// Connect!
startTime = System.nanoTime();
transport.open();
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Opening connection:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Initialize maxfile
startTime = System.nanoTime();
final long maxfile = client.PassThrough_init();
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Initializing maxfile:\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Load DFE
startTime = System.nanoTime();
final long engine = client.max_load(maxfile, "*");
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Loading DFE:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Allocate and send input streams to server
startTime = System.nanoTime();
final long addressDataIn = client.malloc_float(size);
client.send_data_float(addressDataIn, dataIn);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Sending input data:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Allocate memory for output stream on server
startTime = System.nanoTime();
final long addressDataOut = client.malloc_float(size);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Allocating memory for output stream on server:\t"
+ timeFormat.format(estimatedTime) + "s");
// Action default
startTime = System.nanoTime();
final long sizeBytes = size * SIZE_OF_INT_IN_BYTES;
final long actions = client.max_actions_init(maxfile, "default");
client.max_set_param_uint64t(actions, "N", size);
client.max_queue_input(actions, "x", addressDataIn, sizeBytes);
client.max_queue_output(actions, "y", addressDataOut, sizeBytes);
client.max_run(engine, actions);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Pass through time:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Unload DFE
startTime = System.nanoTime();
client.max_unload(engine);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Unloading DFE:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Get output stream from server
startTime = System.nanoTime();
dataOut = client.receive_data_float(addressDataOut, size);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Getting output stream:\t(size = "
+ size * SIZE_OF_INT + " bit)\t"
+ timeFormat.format(estimatedTime) + "s");
// Free allocated memory for streams on server
startTime = System.nanoTime();
client.free(addressDataIn);
client.free(addressDataOut);
client.free(actions);
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Freeing allocated memory for streams on server:\t"
+ timeFormat.format(estimatedTime) + "s");
// Free allocated maxfile data
startTime = System.nanoTime();
client.PassThrough_free();
System.out.println("Freeing allocated maxfile data:\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
// Close!
startTime = System.nanoTime();
transport.close();
estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS;
System.out.println("Closing connection:\t\t\t\t\t"
+ timeFormat.format(estimatedTime) + "s");
} catch (TException x) {
x.printStackTrace();
System.exit(-1);
}
return dataOut;
} | static List<Double> function(final int size, final List<Double> dataIn) { List<Double> dataOut = new ArrayList<Double>(); final DecimalFormat timeFormat = new DecimalFormat(STR); double startTime = System.nanoTime(); TTransport transport = new TSocket(STR, PORT); TProtocol protocol = new TBinaryProtocol(transport); PassThroughService.Client client = new PassThroughService.Client(protocol); double estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); try { startTime = System.nanoTime(); transport.open(); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); final long maxfile = client.PassThrough_init(); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); final long engine = client.max_load(maxfile, "*"); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); final long addressDataIn = client.malloc_float(size); client.send_data_float(addressDataIn, dataIn); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); final long addressDataOut = client.malloc_float(size); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); final long sizeBytes = size * SIZE_OF_INT_IN_BYTES; final long actions = client.max_actions_init(maxfile, STR); client.max_set_param_uint64t(actions, "N", size); client.max_queue_input(actions, "x", addressDataIn, sizeBytes); client.max_queue_output(actions, "y", addressDataOut, sizeBytes); client.max_run(engine, actions); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); client.max_unload(engine); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); dataOut = client.receive_data_float(addressDataOut, size); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + size * SIZE_OF_INT + STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); client.free(addressDataIn); client.free(addressDataOut); client.free(actions); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); client.PassThrough_free(); System.out.println(STR + timeFormat.format(estimatedTime) + "s"); startTime = System.nanoTime(); transport.close(); estimatedTime = (System.nanoTime() - startTime) / NUM_OF_NANO_SECONDS; System.out.println(STR + timeFormat.format(estimatedTime) + "s"); } catch (TException x) { x.printStackTrace(); System.exit(-1); } return dataOut; } | /**
* PassThrough on DFE.
*
* @param size Size
* @param dataIn Data input
*
* @return Data output
*/ | PassThrough on DFE | passThroughDfe | {
"repo_name": "maxeler/maxskins",
"path": "examples/PassThrough/client/java/Dynamic/PassThroughClient.java",
"license": "bsd-2-clause",
"size": 8521
} | [
"com.maxeler.PassThrough",
"java.text.DecimalFormat",
"java.util.ArrayList",
"java.util.List",
"org.apache.thrift.TException",
"org.apache.thrift.protocol.TBinaryProtocol",
"org.apache.thrift.protocol.TProtocol",
"org.apache.thrift.transport.TSocket",
"org.apache.thrift.transport.TTransport"
] | import com.maxeler.PassThrough; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; | import com.maxeler.*; import java.text.*; import java.util.*; import org.apache.thrift.*; import org.apache.thrift.protocol.*; import org.apache.thrift.transport.*; | [
"com.maxeler",
"java.text",
"java.util",
"org.apache.thrift"
] | com.maxeler; java.text; java.util; org.apache.thrift; | 609,337 |
public static String getRandomFragment() {
return UUID.randomUUID().toString();
}
public static final AtomicLong streamThreadSerial = new AtomicLong();
| static String function() { return UUID.randomUUID().toString(); } public static final AtomicLong streamThreadSerial = new AtomicLong(); | /**
* Generates a random string made up from a UUID.
* @return a random string
*/ | Generates a random string made up from a UUID | getRandomFragment | {
"repo_name": "nickman/UnsafeAdapter",
"path": "unsafeadapter-core/src/test/java/test/com/heliosapm/unsafe/BaseTest.java",
"license": "lgpl-2.1",
"size": 15123
} | [
"java.util.UUID",
"java.util.concurrent.atomic.AtomicLong"
] | import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; | import java.util.*; import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 2,827,067 |
@Test
public void fromFilenames_Single_toFile() throws IOException
{
// given
String f = "src/test/resources/Thumbnailator/grid.png";
File outFile = new File("src/test/resources/Thumbnailator/grid.tmp.png");
outFile.deleteOnExit();
// when
Thumbnails.fromFilenames(Arrays.asList(f))
.size(50, 50)
.toFile(outFile);
// then
BufferedImage fromFileImage = ImageIO.read(outFile);
assertEquals(50, fromFileImage.getWidth());
assertEquals(50, fromFileImage.getHeight());
}
| void function() throws IOException { String f = STR; File outFile = new File(STR); outFile.deleteOnExit(); Thumbnails.fromFilenames(Arrays.asList(f)) .size(50, 50) .toFile(outFile); BufferedImage fromFileImage = ImageIO.read(outFile); assertEquals(50, fromFileImage.getWidth()); assertEquals(50, fromFileImage.getHeight()); } | /**
* Test for the {@link Thumbnails.Builder} class where,
* <ol>
* <li>Thumbnails.fromFilenames([String])</li>
* <li>toFile(File)</li>
* </ol>
* and the expected outcome is,
* <ol>
* <li>An image is written to the specified file.</li>
* </ol>
* @throws IOException
*/ | Test for the <code>Thumbnails.Builder</code> class where, Thumbnails.fromFilenames([String]) toFile(File) and the expected outcome is, An image is written to the specified file. | fromFilenames_Single_toFile | {
"repo_name": "passerby4j/thumbnailator",
"path": "src/test/java/net/coobird/thumbnailator/ThumbnailsBuilderInputOutputTest.java",
"license": "mit",
"size": 303967
} | [
"java.awt.image.BufferedImage",
"java.io.File",
"java.io.IOException",
"java.util.Arrays",
"javax.imageio.ImageIO",
"org.junit.Assert"
] | import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Arrays; import javax.imageio.ImageIO; import org.junit.Assert; | import java.awt.image.*; import java.io.*; import java.util.*; import javax.imageio.*; import org.junit.*; | [
"java.awt",
"java.io",
"java.util",
"javax.imageio",
"org.junit"
] | java.awt; java.io; java.util; javax.imageio; org.junit; | 272,294 |
public void setAssetValueAmt (BigDecimal AssetValueAmt); | void function (BigDecimal AssetValueAmt); | /** Set Asset value.
* Book Value of the asset
*/ | Set Asset value. Book Value of the asset | setAssetValueAmt | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_A_Asset_Retirement.java",
"license": "gpl-2.0",
"size": 5449
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 260,768 |
public Set<OWLLiteral> getLabel(OWLEntity entity);
| Set<OWLLiteral> function(OWLEntity entity); | /**
* Returns the RDFS labels of an entity.
* @param entity An entity, e.g. Machine.
* @return All values of rdfs:label for the entity, e.g. {"Machine"@en, "Maschine"@de}.
*/ | Returns the RDFS labels of an entity | getLabel | {
"repo_name": "MaRoe/DL-Learner",
"path": "components-core/src/main/java/org/dllearner/core/BaseReasoner.java",
"license": "gpl-3.0",
"size": 5047
} | [
"java.util.Set",
"org.semanticweb.owlapi.model.OWLEntity",
"org.semanticweb.owlapi.model.OWLLiteral"
] | import java.util.Set; import org.semanticweb.owlapi.model.OWLEntity; import org.semanticweb.owlapi.model.OWLLiteral; | import java.util.*; import org.semanticweb.owlapi.model.*; | [
"java.util",
"org.semanticweb.owlapi"
] | java.util; org.semanticweb.owlapi; | 2,635,627 |
private final void __uri(final IOJob job, final S data, final URI uri,
final StreamEncoding<?, ?> encoding, final EArchiveType archiveType)
throws Throwable {
URL url;
Path path;
Throwable errorA, errorB, ioError;
final Object oldCur;
oldCur = job.m_current;
try {
job.m_current = uri;
errorA = null;
url = null;
try {
url = uri.toURL();
} catch (final Throwable throwable) {
errorA = throwable;
url = null;
}
if (url != null) {
this.__url(job, data, url, encoding, archiveType);
return;
}
path = null;
errorB = null;
try {
path = Paths.get(uri);
} catch (final Throwable throwable) {
errorB = throwable;
path = null;
}
if (path != null) {
this._path(job, data, path,
Files.readAttributes(path, BasicFileAttributes.class),
encoding, archiveType);
return;
}
ioError = new IOException("URI '" + uri + //$NON-NLS-1$
"' cannot be processed."); //$NON-NLS-1$
if (errorA != null) {
ioError.addSuppressed(errorA);
}
if (errorB != null) {
ioError.addSuppressed(errorB);
}
throw ioError;
} finally {
job.m_current = oldCur;
}
}
| final void function(final IOJob job, final S data, final URI uri, final StreamEncoding<?, ?> encoding, final EArchiveType archiveType) throws Throwable { URL url; Path path; Throwable errorA, errorB, ioError; final Object oldCur; oldCur = job.m_current; try { job.m_current = uri; errorA = null; url = null; try { url = uri.toURL(); } catch (final Throwable throwable) { errorA = throwable; url = null; } if (url != null) { this.__url(job, data, url, encoding, archiveType); return; } path = null; errorB = null; try { path = Paths.get(uri); } catch (final Throwable throwable) { errorB = throwable; path = null; } if (path != null) { this._path(job, data, path, Files.readAttributes(path, BasicFileAttributes.class), encoding, archiveType); return; } ioError = new IOException(STR + uri + STR); if (errorA != null) { ioError.addSuppressed(errorA); } if (errorB != null) { ioError.addSuppressed(errorB); } throw ioError; } finally { job.m_current = oldCur; } } | /**
* Handle an URI
*
* @param job
* the job where logging info can be written
* @param data
* the data to be read
* @param uri
* the uri
* @param encoding
* the encoding
* @param archiveType
* the archive type
* @throws Throwable
* if it must
*/ | Handle an URI | __uri | {
"repo_name": "optimizationBenchmarking/utils-base",
"path": "src/main/java/org/optimizationBenchmarking/utils/io/structured/impl/abstr/FileInputTool.java",
"license": "gpl-3.0",
"size": 22273
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path",
"java.nio.file.Paths",
"java.nio.file.attribute.BasicFileAttributes"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; | import java.io.*; import java.nio.file.*; import java.nio.file.attribute.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 563,859 |
@Override
public void computeRoute(final String formatedDest, final CancelMonitor monitor, final boolean resolveHostname, final boolean ipV4, final int maxHops)
throws Exception {
try {
String cmd;
if (Env.INSTANCE.getOs() == OS.win) {
cmd = "tracert -d -w 1000";
if (!ipV4) {
cmd += " -6";
}
cmd += " -h " + maxHops;
} else {
cmd = "traceroute";
if (!ipV4) {
cmd += "6";
}
cmd += " -q 1 -n";
cmd += " -m " + maxHops;
}
final Process process = Runtime.getRuntime().exec(cmd + " " + formatedDest);
try {
final InputStream input = process.getInputStream();
final int ignoreLines = Env.INSTANCE.getOs() == OS.win ? 4 : (Env.INSTANCE.getOs() == OS.mac ? 0 : 1);
// check if the host exists
final String destIp = InetAddress.getByName(formatedDest).getHostAddress();
int lineNum = 0;
boolean completed = false;
RoutePoint previous = null;
while (!completed && !monitor.isCanceled()) {
char c;
final StringBuilder linebuffer = new StringBuilder();
do {
final int r = input.read();
if (r == -1) {
if (Env.INSTANCE.getOs() == OS.win) {
//on windows, we expect a Trace complete to terminate the execution
throw new RouteException("Failed to traceroute to host");
} else {
// but on other OS, that's just an end of stream
completed = true;
break;
}
}
c = Character.toChars(r)[0];
if (c != '\n') {
linebuffer.append(c);
}
} while (c != '\n');
//System.out.println(lineNum + ":" + linebuffer);
lineNum++;
if (lineNum <= ignoreLines) {
continue;
}
if (linebuffer.toString().startsWith("traceroute: Warning: " + formatedDest + " has multiple addresses")) {
continue;
}
if (linebuffer.toString().startsWith("over a maximum")) {
continue;
}
final String line = Util.replaceTs(linebuffer.toString().trim().replaceAll(" +", " "), Env.INSTANCE.getOs() == OS.win ? 3 : 1).replaceAll(" +", " ");
if (line.isEmpty()) {
continue;
}
if (line.contains("Trace complete")) {
break;
}
if (monitor.isCanceled()) {
break;
}
if (line.contains("*")) {
if (previous != null) {
previous = previous.toUnkown();
addPoint(previous);
}
continue;
}
final String[] routePoint = line.split(" ");
final String ip;
String host = "";
final int latency;
int dnslookupTime = DNSLookupService.UNDEF;
if (Env.INSTANCE.getOs() == OS.win) {
latency = (parseWindowsTime(routePoint[1]) + parseWindowsTime(routePoint[2]) + parseWindowsTime(routePoint[3])) / 3;
// if (resolveHostname) {
// if (routePoint.length > 5) {
// host = routePoint[4];
// ip = routePoint[5].replace("[", "").replace("]", "");
// } else {
// ip = routePoint[4];
// }
// } else {
ip = routePoint[4];
// }
} else {
// if (resolveHostname) {
// if (routePoint.length > 3) {
// host = routePoint[1];
// ip = routePoint[2].replace("(", "").replace(")", "");
// latency = (int) Float.parseFloat(routePoint[3]);
// } else {
// ip = routePoint[1].replace("(", "").replace(")", "");
// latency = (int) Float.parseFloat(routePoint[2]);
// }
// } else {
ip = routePoint[1];
latency = (int) Float.parseFloat(routePoint[2]);
// }
}
if (resolveHostname) {
final long now = System.currentTimeMillis();
host = _services.getDnsLookup().dnsLookup(ip);
dnslookupTime = (int) (System.currentTimeMillis() - now);
}
previous = addPoint(Pair.of(ip, host), latency, dnslookupTime);
}
if (monitor.isCanceled()) {
return;
}
final InputStream error = process.getErrorStream();
final List<String> errors = Util.readUTF8File(error);
if (!errors.isEmpty()) {
final StringBuilder m = new StringBuilder();
for (final String e : errors) {
// for some reason, this info message is dumped to the error stream, so just ignore it
if (!e.startsWith("traceroute to " + formatedDest) && !e.startsWith("traceroute: Warning: " + formatedDest + " has multiple addresses")) {
m.append(e).append("\n");
}
}
// notify error
if (!m.toString().isEmpty()) {
throw new IOException(m.toString());
}
}
// reached the max hops but not the target iup
if (previous != null && previous.getNumber() == maxHops && !previous.getIp().equals(destIp)) {
throw new MaxHopsException();
}
} finally {
try {
process.destroy();
} catch (final Exception e) {
LOGGER.error("Failed to destroy os traceroute process", e);
}
}
} catch (final MaxHopsException e) {
throw e;
} catch (final IOException e) {
throw e;
} catch (final Exception e) {
LOGGER.error("error while performing trace route command", e);
}
} | void function(final String formatedDest, final CancelMonitor monitor, final boolean resolveHostname, final boolean ipV4, final int maxHops) throws Exception { try { String cmd; if (Env.INSTANCE.getOs() == OS.win) { cmd = STR; if (!ipV4) { cmd += STR; } cmd += STR + maxHops; } else { cmd = STR; if (!ipV4) { cmd += "6"; } cmd += STR; cmd += STR + maxHops; } final Process process = Runtime.getRuntime().exec(cmd + " " + formatedDest); try { final InputStream input = process.getInputStream(); final int ignoreLines = Env.INSTANCE.getOs() == OS.win ? 4 : (Env.INSTANCE.getOs() == OS.mac ? 0 : 1); final String destIp = InetAddress.getByName(formatedDest).getHostAddress(); int lineNum = 0; boolean completed = false; RoutePoint previous = null; while (!completed && !monitor.isCanceled()) { char c; final StringBuilder linebuffer = new StringBuilder(); do { final int r = input.read(); if (r == -1) { if (Env.INSTANCE.getOs() == OS.win) { throw new RouteException(STR); } else { completed = true; break; } } c = Character.toChars(r)[0]; if (c != '\n') { linebuffer.append(c); } } while (c != '\n'); lineNum++; if (lineNum <= ignoreLines) { continue; } if (linebuffer.toString().startsWith(STR + formatedDest + STR)) { continue; } if (linebuffer.toString().startsWith(STR)) { continue; } final String line = Util.replaceTs(linebuffer.toString().trim().replaceAll(STR, " "), Env.INSTANCE.getOs() == OS.win ? 3 : 1).replaceAll(STR, " "); if (line.isEmpty()) { continue; } if (line.contains(STR)) { break; } if (monitor.isCanceled()) { break; } if (line.contains("*")) { if (previous != null) { previous = previous.toUnkown(); addPoint(previous); } continue; } final String[] routePoint = line.split(" "); final String ip; String host = STRtraceroute to " + formatedDest) && !e.startsWith(STR + formatedDest + STR)) { m.append(e).append("\nSTRFailed to destroy os traceroute processSTRerror while performing trace route command", e); } } | /**
* Compute the route using OS command
* @param formatedDest
* @param monitor
* @param resolveHostname
*/ | Compute the route using OS command | computeRoute | {
"repo_name": "leolewis/openvisualtraceroute",
"path": "org.leo.traceroute/src/org/leo/traceroute/core/route/impl/OSTraceRoute.java",
"license": "lgpl-3.0",
"size": 8673
} | [
"java.io.InputStream",
"java.net.InetAddress",
"org.leo.traceroute.core.route.RouteException",
"org.leo.traceroute.core.route.RoutePoint",
"org.leo.traceroute.install.Env",
"org.leo.traceroute.ui.task.CancelMonitor",
"org.leo.traceroute.util.Util"
] | import java.io.InputStream; import java.net.InetAddress; import org.leo.traceroute.core.route.RouteException; import org.leo.traceroute.core.route.RoutePoint; import org.leo.traceroute.install.Env; import org.leo.traceroute.ui.task.CancelMonitor; import org.leo.traceroute.util.Util; | import java.io.*; import java.net.*; import org.leo.traceroute.core.route.*; import org.leo.traceroute.install.*; import org.leo.traceroute.ui.task.*; import org.leo.traceroute.util.*; | [
"java.io",
"java.net",
"org.leo.traceroute"
] | java.io; java.net; org.leo.traceroute; | 2,090,689 |
public static ObjectId randomId() {
byte[] b = new byte[LENGTH];
new Random().nextBytes(b);
return new ObjectId(b);
}
public ObjectId(byte[] id) {
super(id);
} | static ObjectId function() { byte[] b = new byte[LENGTH]; new Random().nextBytes(b); return new ObjectId(b); } public ObjectId(byte[] id) { super(id); } | /**
* Generate an ObjectId with random value.
*/ | Generate an ObjectId with random value | randomId | {
"repo_name": "atumanov/ray",
"path": "java/api/src/main/java/org/ray/api/id/ObjectId.java",
"license": "apache-2.0",
"size": 1273
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 1,473,005 |
RoutineResult changeUserRoles(long userId, Collection<Long> rolesToAddIds,
Collection<Long> rolesToRemoveIds,
Collection<Long> rolesToGrantActionsIds); | RoutineResult changeUserRoles(long userId, Collection<Long> rolesToAddIds, Collection<Long> rolesToRemoveIds, Collection<Long> rolesToGrantActionsIds); | /**
* Changes a list of roles assigned to a user.
*
* @param userId ID of the user to change
* @param rolesToAddIds list of IDs of roles to be added
* @param rolesToRemoveIds list of IDs of roles to be removed
* @param rolesToGrantActionsIds list of IDs of roles
* from which all roles will be assigned to user
* (it must be a subset of rolesToAddIds)
* @return routine result
*/ | Changes a list of roles assigned to a user | changeUserRoles | {
"repo_name": "rpuch/superfly",
"path": "superfly-service/src/main/java/com/payneteasy/superfly/service/UserService.java",
"license": "apache-2.0",
"size": 15377
} | [
"com.payneteasy.superfly.model.RoutineResult",
"java.util.Collection"
] | import com.payneteasy.superfly.model.RoutineResult; import java.util.Collection; | import com.payneteasy.superfly.model.*; import java.util.*; | [
"com.payneteasy.superfly",
"java.util"
] | com.payneteasy.superfly; java.util; | 1,600,605 |
@Deprecated
public List<?> getRefMonthStats(String docName, Date month, XWikiContext context) throws XWikiException
{
XWikiHibernateStore store = context.getWiki().getHibernateStore();
List<?> solist;
if (store != null) {
List<Object> paramList = new ArrayList<>(1);
paramList.add(docName);
solist = store.search("from RefererStats as obj where obj.name=?", 0, 0, paramList, context);
} else {
solist = Collections.emptyList();
}
return solist;
} | List<?> function(String docName, Date month, XWikiContext context) throws XWikiException { XWikiHibernateStore store = context.getWiki().getHibernateStore(); List<?> solist; if (store != null) { List<Object> paramList = new ArrayList<>(1); paramList.add(docName); solist = store.search(STR, 0, 0, paramList, context); } else { solist = Collections.emptyList(); } return solist; } | /**
* Gets monthly referer statistics.
*
* @param docName fully qualified document name.
* @param month the month.
* @param context the XWiki context.
* @return the monthly referer statistics.
* @throws XWikiException error when searching for referer statistics.
* @deprecated use {@link #getRefererStatistics(String, Scope, Period, Range, XWikiContext)} instead.
*/ | Gets monthly referer statistics | getRefMonthStats | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/stats/impl/xwiki/XWikiStatsReader.java",
"license": "lgpl-2.1",
"size": 23801
} | [
"com.xpn.xwiki.XWikiContext",
"com.xpn.xwiki.XWikiException",
"com.xpn.xwiki.store.XWikiHibernateStore",
"java.util.ArrayList",
"java.util.Collections",
"java.util.Date",
"java.util.List"
] | import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.store.XWikiHibernateStore; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; | import com.xpn.xwiki.*; import com.xpn.xwiki.store.*; import java.util.*; | [
"com.xpn.xwiki",
"java.util"
] | com.xpn.xwiki; java.util; | 2,485,357 |
public void imprimeDatosPanelFuncion() {
addLinePlot("El Mejor de Ejec.", Color.BLUE, _xParametroVariable, _yAptitudMejor);
addLinePlot("Media de Ejec.", Color.GREEN, _xParametroVariable, _yAptitudMedia);
} | void function() { addLinePlot(STR, Color.BLUE, _xParametroVariable, _yAptitudMejor); addLinePlot(STR, Color.GREEN, _xParametroVariable, _yAptitudMedia); } | /**
* Imprime los resultados de los vectores en la grafica.
*/ | Imprime los resultados de los vectores en la grafica | imprimeDatosPanelFuncion | {
"repo_name": "salcedonia/evolutionary-programming-2009-2010-g20",
"path": "G20P3/src/gui/componentes/PanelFuncion.java",
"license": "gpl-2.0",
"size": 3647
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,713,054 |
public static long toTimeStamp(String dateTime, String pattern, int timeZoneOffset) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat(pattern);
return toTimeStamp(dateTime, format, timeZoneOffset);
}
| static long function(String dateTime, String pattern, int timeZoneOffset) throws ParseException { SimpleDateFormat format = new SimpleDateFormat(pattern); return toTimeStamp(dateTime, format, timeZoneOffset); } | /**
* Convert a string to a time stamp using a string pattern.
*/ | Convert a string to a time stamp using a string pattern | toTimeStamp | {
"repo_name": "wgpshashank/aerospike-client-java",
"path": "client/src/com/aerospike/client/util/Util.java",
"license": "apache-2.0",
"size": 5355
} | [
"java.text.ParseException",
"java.text.SimpleDateFormat"
] | import java.text.ParseException; import java.text.SimpleDateFormat; | import java.text.*; | [
"java.text"
] | java.text; | 799,553 |
@RequestMapping("/uploadFile.do")
public ModelAndView uploadFile(HttpServletRequest request,
HttpServletResponse response,
@RequestParam("jobId") String jobId) {
//Lookup our job
VEGLJob job = null;
try {
job = jobManager.getJobById(Integer.parseInt(jobId));
} catch (Exception ex) {
logger.error("Error fetching job with id " + jobId, ex);
return generateJSONResponseMAV(false, null, "Error fetching job with id " + jobId);
}
//Handle incoming file
StagedFile file = null;
try {
file = fileStagingService.handleFileUpload(job, (MultipartHttpServletRequest) request);
} catch (Exception ex) {
logger.error("Error uploading file", ex);
return generateJSONResponseMAV(false, null, "Error uploading file");
}
FileInformation fileInfo = stagedFileToFileInformation(file);
//We have to use a HTML response due to ExtJS's use of a hidden iframe for file uploads
//Failure to do this will result in the upload working BUT the user will also get prompted
//for a file download containing the encoded response from this function (which we don't want).
return generateHTMLResponseMAV(true, Arrays.asList(fileInfo), "");
} | @RequestMapping(STR) ModelAndView function(HttpServletRequest request, HttpServletResponse response, @RequestParam("jobId") String jobId) { VEGLJob job = null; try { job = jobManager.getJobById(Integer.parseInt(jobId)); } catch (Exception ex) { logger.error(STR + jobId, ex); return generateJSONResponseMAV(false, null, STR + jobId); } StagedFile file = null; try { file = fileStagingService.handleFileUpload(job, (MultipartHttpServletRequest) request); } catch (Exception ex) { logger.error(STR, ex); return generateJSONResponseMAV(false, null, STR); } FileInformation fileInfo = stagedFileToFileInformation(file); return generateHTMLResponseMAV(true, Arrays.asList(fileInfo), ""); } | /**
* Processes a file upload request returning a JSON object which indicates
* whether the upload was successful and contains the filename and file
* size.
*
* @param request The servlet request
* @param response The servlet response containing the JSON data
*
* @return null
*/ | Processes a file upload request returning a JSON object which indicates whether the upload was successful and contains the filename and file size | uploadFile | {
"repo_name": "AuScope/VEGL-Portal",
"path": "src/main/java/org/auscope/portal/server/web/controllers/JobBuilderController.java",
"license": "gpl-3.0",
"size": 43657
} | [
"java.util.Arrays",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.auscope.portal.core.cloud.StagedFile",
"org.auscope.portal.server.gridjob.FileInformation",
"org.auscope.portal.server.vegl.VEGLJob",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestParam",
"org.springframework.web.multipart.MultipartHttpServletRequest",
"org.springframework.web.servlet.ModelAndView"
] | import java.util.Arrays; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.auscope.portal.core.cloud.StagedFile; import org.auscope.portal.server.gridjob.FileInformation; import org.auscope.portal.server.vegl.VEGLJob; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; | import java.util.*; import javax.servlet.http.*; import org.auscope.portal.core.cloud.*; import org.auscope.portal.server.gridjob.*; import org.auscope.portal.server.vegl.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.*; import org.springframework.web.servlet.*; | [
"java.util",
"javax.servlet",
"org.auscope.portal",
"org.springframework.web"
] | java.util; javax.servlet; org.auscope.portal; org.springframework.web; | 1,839,937 |
public static void removeStudent(String observerId, String studentId, CanvasCallback<Response> callback) {
if(APIHelpers.paramIsNull(callback)) { return; }
buildInterface(UsersInterface.class, APIHelpers.getAirwolfDomain(callback.getContext()), callback).removeStudent(observerId, studentId, callback);
} | static void function(String observerId, String studentId, CanvasCallback<Response> callback) { if(APIHelpers.paramIsNull(callback)) { return; } buildInterface(UsersInterface.class, APIHelpers.getAirwolfDomain(callback.getContext()), callback).removeStudent(observerId, studentId, callback); } | /**
* Remove student from Airwolf. Currently only used in the Parent App
*
* @param observerId
* @param studentId
* @param callback - 200 if successful
*/ | Remove student from Airwolf. Currently only used in the Parent App | removeStudent | {
"repo_name": "instructure/CanvasAPI",
"path": "src/main/java/com/instructure/canvasapi/api/UserAPI.java",
"license": "mit",
"size": 23611
} | [
"com.instructure.canvasapi.utilities.APIHelpers",
"com.instructure.canvasapi.utilities.CanvasCallback"
] | import com.instructure.canvasapi.utilities.APIHelpers; import com.instructure.canvasapi.utilities.CanvasCallback; | import com.instructure.canvasapi.utilities.*; | [
"com.instructure.canvasapi"
] | com.instructure.canvasapi; | 2,489,086 |
public boolean onCreateFancyMenu(Intent intent, View view, float x, float y) {
String path = intent.getStringExtra(LibraryAdapter.DATA_FILE);
boolean isParentRow = (path != null && pointsToParentFolder(new File(path)));
if (!isParentRow)
return mActivity.onCreateFancyMenu(intent, view, x, y);
// else: no context menu, but consume event.
return true;
} | boolean function(Intent intent, View view, float x, float y) { String path = intent.getStringExtra(LibraryAdapter.DATA_FILE); boolean isParentRow = (path != null && pointsToParentFolder(new File(path))); if (!isParentRow) return mActivity.onCreateFancyMenu(intent, view, x, y); return true; } | /**
* Context menu of a row: this was dispatched by LibraryPagerAdapter
*
* @param intent likely created by createData()
* @param view the parent view
* @param x x-coords of event
* @param y y-coords of event
*/ | Context menu of a row: this was dispatched by LibraryPagerAdapter | onCreateFancyMenu | {
"repo_name": "vanilla-music/vanilla",
"path": "app/src/main/java/ch/blinkenlights/android/vanilla/FileSystemAdapter.java",
"license": "gpl-3.0",
"size": 12875
} | [
"android.content.Intent",
"android.view.View",
"java.io.File"
] | import android.content.Intent; import android.view.View; import java.io.File; | import android.content.*; import android.view.*; import java.io.*; | [
"android.content",
"android.view",
"java.io"
] | android.content; android.view; java.io; | 1,677,433 |
public static void startActivityForResult(@NonNull final Bundle extras,
@NonNull final Fragment fragment,
@NonNull final Class<? extends Activity> clz,
final int requestCode,
final View... sharedElements) {
startActivityForResult(fragment, extras, Utils.getApp().getPackageName(), clz.getName(),
requestCode, getOptionsBundle(fragment, sharedElements));
} | static void function(@NonNull final Bundle extras, @NonNull final Fragment fragment, @NonNull final Class<? extends Activity> clz, final int requestCode, final View... sharedElements) { startActivityForResult(fragment, extras, Utils.getApp().getPackageName(), clz.getName(), requestCode, getOptionsBundle(fragment, sharedElements)); } | /**
* Start the activity.
*
* @param extras The Bundle of extras to add to this intent.
* @param fragment The fragment.
* @param clz The activity class.
* @param requestCode if >= 0, this code will be returned in
* onActivityResult() when the activity exits.
* @param sharedElements The names of the shared elements to transfer to the called
* Activity and their associated Views.
*/ | Start the activity | startActivityForResult | {
"repo_name": "didi/DoraemonKit",
"path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/ActivityUtils.java",
"license": "apache-2.0",
"size": 90700
} | [
"android.app.Activity",
"android.app.Fragment",
"android.os.Bundle",
"android.view.View",
"androidx.annotation.NonNull",
"androidx.fragment.app.Fragment"
] | import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; | import android.app.*; import android.os.*; import android.view.*; import androidx.annotation.*; import androidx.fragment.app.*; | [
"android.app",
"android.os",
"android.view",
"androidx.annotation",
"androidx.fragment"
] | android.app; android.os; android.view; androidx.annotation; androidx.fragment; | 2,638,887 |
public CentralDogmaBuilder tls(TlsConfig tls) {
this.tls = requireNonNull(tls, "tls");
return this;
} | CentralDogmaBuilder function(TlsConfig tls) { this.tls = requireNonNull(tls, "tls"); return this; } | /**
* Sets a {@link TlsConfig} for supporting TLS on the server.
*/ | Sets a <code>TlsConfig</code> for supporting TLS on the server | tls | {
"repo_name": "line/centraldogma",
"path": "server/src/main/java/com/linecorp/centraldogma/server/CentralDogmaBuilder.java",
"license": "apache-2.0",
"size": 23802
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 437,831 |
public static String formatExchangeRate(
Optional<String> exchangeRate,
LanguageConfiguration languageConfiguration,
BitcoinConfiguration bitcoinConfiguration
) {
Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be non null");
Preconditions.checkState(exchangeRate.isPresent(), "'exchangeRate' must be present");
Preconditions.checkNotNull(languageConfiguration, "'languageConfiguration' must be present");
Preconditions.checkNotNull(bitcoinConfiguration, "'bitcoinConfiguration' must be present");
BigDecimal exchangeRateBigDecimal = new BigDecimal(exchangeRate.get());
// Correct for non unitary bitcoin display units e.g 567 USD per BTCis identical to 0.567 USD per mBTC
BigDecimal correctedExchangeRateBigDecimal = exchangeRateBigDecimal.divide(BitcoinSymbol.current().multiplier());
Locale currentLocale = languageConfiguration.getLocale();
DecimalFormatSymbols dfs = configureDecimalFormatSymbols(bitcoinConfiguration, currentLocale);
DecimalFormat localFormat = configureLocalDecimalFormat(dfs, bitcoinConfiguration, false);
localFormat.setMinimumFractionDigits(Formats.EXCHANGE_RATE_DECIMAL_PLACES_OFFSET + (int)Math.log10(BitcoinSymbol.current().multiplier().doubleValue()));
return localFormat.format(correctedExchangeRateBigDecimal);
} | static String function( Optional<String> exchangeRate, LanguageConfiguration languageConfiguration, BitcoinConfiguration bitcoinConfiguration ) { Preconditions.checkNotNull(exchangeRate, STR); Preconditions.checkState(exchangeRate.isPresent(), STR); Preconditions.checkNotNull(languageConfiguration, STR); Preconditions.checkNotNull(bitcoinConfiguration, STR); BigDecimal exchangeRateBigDecimal = new BigDecimal(exchangeRate.get()); BigDecimal correctedExchangeRateBigDecimal = exchangeRateBigDecimal.divide(BitcoinSymbol.current().multiplier()); Locale currentLocale = languageConfiguration.getLocale(); DecimalFormatSymbols dfs = configureDecimalFormatSymbols(bitcoinConfiguration, currentLocale); DecimalFormat localFormat = configureLocalDecimalFormat(dfs, bitcoinConfiguration, false); localFormat.setMinimumFractionDigits(Formats.EXCHANGE_RATE_DECIMAL_PLACES_OFFSET + (int)Math.log10(BitcoinSymbol.current().multiplier().doubleValue())); return localFormat.format(correctedExchangeRateBigDecimal); } | /**
* <p>Convert the bitcoin exchange rate to use the unit of bitcoin being displayed</p>
* <p>For example, 589.00 will become "0,589" if the unit of bitcoin is mB and the decimal separator is ","</p>
* <p>The value passed into formatExchangeRate must be in "fiat currency per bitcoin" and NOT localised</p>
*
* @param exchangeRate The exchange rate in fiat per bitcoin
* @param languageConfiguration The language configuration to use as the basis for presentation
* @param bitcoinConfiguration The Bitcoin configuration to use as the basis for the symbol
*
* @return The localised string representing the bitcoin exchange rate in the display bitcoin unit
*/ | Convert the bitcoin exchange rate to use the unit of bitcoin being displayed For example, 589.00 will become "0,589" if the unit of bitcoin is mB and the decimal separator is "," The value passed into formatExchangeRate must be in "fiat currency per bitcoin" and NOT localised | formatExchangeRate | {
"repo_name": "oscarguindzberg/multibit-hd",
"path": "mbhd-swing/src/main/java/org/multibit/hd/ui/languages/Formats.java",
"license": "mit",
"size": 17404
} | [
"com.google.common.base.Optional",
"com.google.common.base.Preconditions",
"java.math.BigDecimal",
"java.text.DecimalFormat",
"java.text.DecimalFormatSymbols",
"java.util.Locale",
"org.multibit.hd.core.config.BitcoinConfiguration",
"org.multibit.hd.core.config.LanguageConfiguration",
"org.multibit.hd.core.utils.BitcoinSymbol"
] | import com.google.common.base.Optional; import com.google.common.base.Preconditions; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; import org.multibit.hd.core.config.BitcoinConfiguration; import org.multibit.hd.core.config.LanguageConfiguration; import org.multibit.hd.core.utils.BitcoinSymbol; | import com.google.common.base.*; import java.math.*; import java.text.*; import java.util.*; import org.multibit.hd.core.config.*; import org.multibit.hd.core.utils.*; | [
"com.google.common",
"java.math",
"java.text",
"java.util",
"org.multibit.hd"
] | com.google.common; java.math; java.text; java.util; org.multibit.hd; | 2,716,966 |
@Override()
public java.lang.Class<?> getJavaClass(
) {
return org.opennms.netmgt.config.datacollection.Systems.class;
} | @Override() java.lang.Class<?> function( ) { return org.opennms.netmgt.config.datacollection.Systems.class; } | /**
* Method getJavaClass.
*
* @return the Java class represented by this descriptor.
*/ | Method getJavaClass | getJavaClass | {
"repo_name": "tharindum/opennms_dashboard",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/datacollection/descriptors/SystemsDescriptor.java",
"license": "gpl-2.0",
"size": 6120
} | [
"org.opennms.netmgt.config.datacollection.Systems"
] | import org.opennms.netmgt.config.datacollection.Systems; | import org.opennms.netmgt.config.datacollection.*; | [
"org.opennms.netmgt"
] | org.opennms.netmgt; | 1,977,154 |
public void setCommitteeSchedule(CommitteeScheduleBase committeeSchedule) {
this.committeeSchedule = committeeSchedule;
} | void function(CommitteeScheduleBase committeeSchedule) { this.committeeSchedule = committeeSchedule; } | /**
* Sets the committeeSchedule attribute.
* @return Returns the committeeSchedule.
*/ | Sets the committeeSchedule attribute | setCommitteeSchedule | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/common/committee/meeting/CommitteeScheduleAttachmentsBase.java",
"license": "apache-2.0",
"size": 10586
} | [
"org.kuali.kra.common.committee.bo.CommitteeScheduleBase"
] | import org.kuali.kra.common.committee.bo.CommitteeScheduleBase; | import org.kuali.kra.common.committee.bo.*; | [
"org.kuali.kra"
] | org.kuali.kra; | 1,405,133 |
protected HashSet<String> getSubFundsNotToBeLoaded() {
HashSet<String> bannedSubFunds;
if (BCConstants.NO_BC_GL_LOAD_FUND_GROUPS.size() != 0) {
Criteria criteriaID = new Criteria();
criteriaID.addIn(KFSPropertyConstants.FUND_GROUP_CODE, BCConstants.NO_BC_GL_LOAD_FUND_GROUPS);
ReportQueryByCriteria queryID = new ReportQueryByCriteria(SubFundGroup.class, criteriaID);
queryID.setAttributes(new String[] { KFSPropertyConstants.SUB_FUND_GROUP_CODE });
bannedSubFunds = new HashSet<String>(hashCapacity(queryID) + BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.size());
Iterator subfundsForBannedFunds = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(queryID);
while (subfundsForBannedFunds.hasNext()) {
bannedSubFunds.add((String) ((Object[]) subfundsForBannedFunds.next())[0]);
}
}
else {
bannedSubFunds = new HashSet<String>(BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.size() + 1);
}
Iterator<String> additionalBannedSubFunds = BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.iterator();
while (additionalBannedSubFunds.hasNext()) {
bannedSubFunds.add(additionalBannedSubFunds.next());
}
return bannedSubFunds;
}
| HashSet<String> function() { HashSet<String> bannedSubFunds; if (BCConstants.NO_BC_GL_LOAD_FUND_GROUPS.size() != 0) { Criteria criteriaID = new Criteria(); criteriaID.addIn(KFSPropertyConstants.FUND_GROUP_CODE, BCConstants.NO_BC_GL_LOAD_FUND_GROUPS); ReportQueryByCriteria queryID = new ReportQueryByCriteria(SubFundGroup.class, criteriaID); queryID.setAttributes(new String[] { KFSPropertyConstants.SUB_FUND_GROUP_CODE }); bannedSubFunds = new HashSet<String>(hashCapacity(queryID) + BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.size()); Iterator subfundsForBannedFunds = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(queryID); while (subfundsForBannedFunds.hasNext()) { bannedSubFunds.add((String) ((Object[]) subfundsForBannedFunds.next())[0]); } } else { bannedSubFunds = new HashSet<String>(BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.size() + 1); } Iterator<String> additionalBannedSubFunds = BCConstants.NO_BC_GL_LOAD_SUBFUND_GROUPS.iterator(); while (additionalBannedSubFunds.hasNext()) { bannedSubFunds.add(additionalBannedSubFunds.next()); } return bannedSubFunds; } | /**
* build a hash set of subfunds whose accounts should NOT be loaded this can be done by either a list of FUND groups and/or a
* list of subfund groups
*
* @see org.kuali.kfs.module.bc.BCConstants to initialize the String[] array(s) as desired
* @return list of subfunds whose accounts will NOT be loaded
*/ | build a hash set of subfunds whose accounts should NOT be loaded this can be done by either a list of FUND groups and/or a list of subfund groups | getSubFundsNotToBeLoaded | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/bc/batch/dataaccess/impl/GeneralLedgerBudgetLoadDaoOjb.java",
"license": "agpl-3.0",
"size": 31961
} | [
"java.util.HashSet",
"java.util.Iterator",
"org.apache.ojb.broker.query.Criteria",
"org.apache.ojb.broker.query.ReportQueryByCriteria",
"org.kuali.kfs.coa.businessobject.SubFundGroup",
"org.kuali.kfs.module.bc.BCConstants",
"org.kuali.kfs.sys.KFSPropertyConstants"
] | import java.util.HashSet; import java.util.Iterator; import org.apache.ojb.broker.query.Criteria; import org.apache.ojb.broker.query.ReportQueryByCriteria; import org.kuali.kfs.coa.businessobject.SubFundGroup; import org.kuali.kfs.module.bc.BCConstants; import org.kuali.kfs.sys.KFSPropertyConstants; | import java.util.*; import org.apache.ojb.broker.query.*; import org.kuali.kfs.coa.businessobject.*; import org.kuali.kfs.module.bc.*; import org.kuali.kfs.sys.*; | [
"java.util",
"org.apache.ojb",
"org.kuali.kfs"
] | java.util; org.apache.ojb; org.kuali.kfs; | 838,591 |
public CharSequenceGeneratorBuilder<VALUE> uniformLength(int min, int max) {
final int range = max - min + 1;
final ToIntFunction<RandomSequence> lengthGenerator = (r) -> r.nextInt(range) + min;
buildGenerator(lengthGenerator);
return CharSequenceGeneratorBuilder.this;
} | CharSequenceGeneratorBuilder<VALUE> function(int min, int max) { final int range = max - min + 1; final ToIntFunction<RandomSequence> lengthGenerator = (r) -> r.nextInt(range) + min; buildGenerator(lengthGenerator); return CharSequenceGeneratorBuilder.this; } | /**
* Specify the probabiliy of the length as uniformly distributed between min and max included
*
*
* @param min
* @param max
* @return
*/ | Specify the probabiliy of the length as uniformly distributed between min and max included | uniformLength | {
"repo_name": "Arboratum-Open/fastbeangen",
"path": "fastbeangen/src/main/java/com/arboratum/beangen/core/CharSequenceGeneratorBuilder.java",
"license": "gpl-3.0",
"size": 8423
} | [
"com.arboratum.beangen.util.RandomSequence",
"java.util.function.ToIntFunction"
] | import com.arboratum.beangen.util.RandomSequence; import java.util.function.ToIntFunction; | import com.arboratum.beangen.util.*; import java.util.function.*; | [
"com.arboratum.beangen",
"java.util"
] | com.arboratum.beangen; java.util; | 1,254,834 |
@SuppressWarnings("unused")
private TimeZone getTimeZone(TimeZone timeZone, int diffRawOffset) {
int offset = timeZone.getRawOffset();
int newOffset = offset < 0 ? offset + diffRawOffset : offset - diffRawOffset;
String[] availableIDs = TimeZone.getAvailableIDs(newOffset);
TimeZone newTimeZone = TimeZone.getTimeZone(availableIDs[0]);
return newTimeZone;
} | @SuppressWarnings(STR) TimeZone function(TimeZone timeZone, int diffRawOffset) { int offset = timeZone.getRawOffset(); int newOffset = offset < 0 ? offset + diffRawOffset : offset - diffRawOffset; String[] availableIDs = TimeZone.getAvailableIDs(newOffset); TimeZone newTimeZone = TimeZone.getTimeZone(availableIDs[0]); return newTimeZone; } | /**
* Returns a timezone with a rawoffset with a different offset.
*
*
* PENDING: this is acutally for european time, not really thought of
* negative/rolling +/- problem?
*
* @param timeZone the timezone to start with
* @param diffRawOffset the raw offset difference.
* @return
*/ | Returns a timezone with a rawoffset with a different offset. negative/rolling +/- problem | getTimeZone | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/test/java/org/jdesktop/swingx/JXMonthViewIssues.java",
"license": "lgpl-2.1",
"size": 29494
} | [
"java.util.TimeZone"
] | import java.util.TimeZone; | import java.util.*; | [
"java.util"
] | java.util; | 2,094,974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.