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 loadUserFromDB()
{
UsersDAO usersDAO = null;
try
{
usersDAO = DataAccessObjectFactory.getInstance().createUsersDAO(getActivity().getBaseContext());
} catch(SQLException e)
{
Toast.makeText(getActivity(), "Could not get UsersDAO due to database errors!", Toast.LENGTH_SHORT).show();
}
if(usersDAO != null)
{
user = usersDAO.load();
}
} | void function() { UsersDAO usersDAO = null; try { usersDAO = DataAccessObjectFactory.getInstance().createUsersDAO(getActivity().getBaseContext()); } catch(SQLException e) { Toast.makeText(getActivity(), STR, Toast.LENGTH_SHORT).show(); } if(usersDAO != null) { user = usersDAO.load(); } } | /**
* This method load the user from db and stores it in the local attribute user
*
* methodtype command method
*/ | This method load the user from db and stores it in the local attribute user methodtype command method | loadUserFromDB | {
"repo_name": "corchwll/amos-ss15-proj5_android",
"path": "app/src/main/java/dess15proj5/fau/cs/osr_amos/mobiletimerecording/ui/DatePickerWithoutDaysDialogFragment.java",
"license": "agpl-3.0",
"size": 5505
} | [
"android.widget.Toast",
"java.sql.SQLException"
] | import android.widget.Toast; import java.sql.SQLException; | import android.widget.*; import java.sql.*; | [
"android.widget",
"java.sql"
] | android.widget; java.sql; | 535,155 |
private Account createAccount(String email, String nick, String passw,
String role) {
Account account = new Account(email, nick, passw, role);
accountRepository.save(account);
return account;
} | Account function(String email, String nick, String passw, String role) { Account account = new Account(email, nick, passw, role); accountRepository.save(account); return account; } | /**
* Creates the account.
*
* @param email
* the email
* @param nick
* the nick
* @param passw
* the passw
* @param role
* the role
* @return the account
*/ | Creates the account | createAccount | {
"repo_name": "iago-suarez/fd-tuiter11",
"path": "tuiter11-model/src/test/java/es/udc/fi/dc/fd/block/BlockTest.java",
"license": "gpl-2.0",
"size": 6707
} | [
"es.udc.fi.dc.fd.account.Account"
] | import es.udc.fi.dc.fd.account.Account; | import es.udc.fi.dc.fd.account.*; | [
"es.udc.fi"
] | es.udc.fi; | 2,647,881 |
private static void validateNoOverlaps(List<CodeReplacement> replacements) {
int start = -1;
for (CodeReplacement replacement : replacements) {
if (replacement.getStartPosition() < start) {
throw new IllegalArgumentException(
"Found overlap between code replacements!\n" + Joiner.on("\n\n").join(replacements));
}
start = Math.max(start, replacement.getStartPosition() + replacement.getLength());
}
} | static void function(List<CodeReplacement> replacements) { int start = -1; for (CodeReplacement replacement : replacements) { if (replacement.getStartPosition() < start) { throw new IllegalArgumentException( STR + Joiner.on("\n\n").join(replacements)); } start = Math.max(start, replacement.getStartPosition() + replacement.getLength()); } } | /**
* Validates that none of the CodeReplacements have any overlap, since applying
* changes that have overlap will produce malformed results.
* The replacements must be provided in order sorted by start position, as sorted
* by ORDER_CODE_REPLACEMENTS.
*/ | Validates that none of the CodeReplacements have any overlap, since applying changes that have overlap will produce malformed results. The replacements must be provided in order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS | validateNoOverlaps | {
"repo_name": "lgeorgieff/closure-compiler",
"path": "src/com/google/javascript/refactoring/ApplySuggestedFixes.java",
"license": "apache-2.0",
"size": 5991
} | [
"com.google.common.base.Joiner",
"java.util.List"
] | import com.google.common.base.Joiner; import java.util.List; | import com.google.common.base.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,361,692 |
public Validator<?> getValidator(); | Validator<?> function(); | /**
* Returns the validator of this field
*
* @return The validator of this field. Null if this field hasn't validator
*/ | Returns the validator of this field | getValidator | {
"repo_name": "frincon/abstractform",
"path": "org.abstractform.binding/src/main/java/org/abstractform/binding/BField.java",
"license": "apache-2.0",
"size": 1580
} | [
"org.abstractform.binding.validation.Validator"
] | import org.abstractform.binding.validation.Validator; | import org.abstractform.binding.validation.*; | [
"org.abstractform.binding"
] | org.abstractform.binding; | 2,636,197 |
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String url = request.toString();
String host = Uri.parse(url).getHost();
if(URL_EXAMPLE.equals(host)) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(intent);
return true;
} | boolean function(WebView view, WebResourceRequest request) { String url = request.toString(); String host = Uri.parse(url).getHost(); if(URL_EXAMPLE.equals(host)) { return false; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); return true; } | /**
*
* Permite que codigo javascript de uma aplicacao web controle o host, ou seja
* permite que um JS controle uma funcionalidade no App
* */ | Permite que codigo javascript de uma aplicacao web controle o host, ou seja permite que um JS controle uma funcionalidade no App | shouldOverrideUrlLoading | {
"repo_name": "chrislucas/repo-android",
"path": "views/screen/StudyWebView/app/src/main/java/com/project/studywebview/Main.java",
"license": "mit",
"size": 7002
} | [
"android.content.Intent",
"android.net.Uri",
"android.webkit.WebResourceRequest",
"android.webkit.WebView"
] | import android.content.Intent; import android.net.Uri; import android.webkit.WebResourceRequest; import android.webkit.WebView; | import android.content.*; import android.net.*; import android.webkit.*; | [
"android.content",
"android.net",
"android.webkit"
] | android.content; android.net; android.webkit; | 1,396,978 |
public PortTypeAnalyzerLinkPersistence getPortTypeAnalyzerLinkPersistence() {
return portTypeAnalyzerLinkPersistence;
} | PortTypeAnalyzerLinkPersistence function() { return portTypeAnalyzerLinkPersistence; } | /**
* Returns the port type analyzer link persistence.
*
* @return the port type analyzer link persistence
*/ | Returns the port type analyzer link persistence | getPortTypeAnalyzerLinkPersistence | {
"repo_name": "queza85/edison",
"path": "edison-portal-framework/edison-appstore-2016-portlet/docroot/WEB-INF/src/org/kisti/edison/science/service/base/CommonModuleServiceBaseImpl.java",
"license": "gpl-3.0",
"size": 52478
} | [
"org.kisti.edison.science.service.persistence.PortTypeAnalyzerLinkPersistence"
] | import org.kisti.edison.science.service.persistence.PortTypeAnalyzerLinkPersistence; | import org.kisti.edison.science.service.persistence.*; | [
"org.kisti.edison"
] | org.kisti.edison; | 2,543,290 |
return ((e.getButton() == MouseEvent.BUTTON1) && (e.getClickCount() == 1));
} | return ((e.getButton() == MouseEvent.BUTTON1) && (e.getClickCount() == 1)); } | /**
* Checks whether the mouse event is a left-click event.
* Ctrl/Alt/Shift are allowed.
*
* @param e the event
* @return true if a left-click event
*/ | Checks whether the mouse event is a left-click event. Ctrl/Alt/Shift are allowed | isLeftClick | {
"repo_name": "Waikato/fcms-widgets",
"path": "src/main/java/nz/ac/waikato/cms/gui/core/MouseUtils.java",
"license": "gpl-3.0",
"size": 3674
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,468,319 |
@NonNull public <T> CharSequence join(@NonNull Iterable<T> items,
@Nullable Formatter<T> formatter) {
checkNotNullOrEmpty(items);
return joinIterableWithSize(items, getSize(items), formatter);
} | @NonNull <T> CharSequence function(@NonNull Iterable<T> items, @Nullable Formatter<T> formatter) { checkNotNullOrEmpty(items); return joinIterableWithSize(items, getSize(items), formatter); } | /**
* A list of objects, converting them to {@code Strings} by passing them to {@link
* Formatter#format(Object)}.
*
* @throws IllegalArgumentException if any of the list elements are null or empty strings.
*/ | A list of objects, converting them to Strings by passing them to <code>Formatter#format(Object)</code> | join | {
"repo_name": "yzbzz/beautifullife",
"path": "icore/src/main/java/com/ddu/icore/util/ListPhrase.java",
"license": "apache-2.0",
"size": 7579
} | [
"androidx.annotation.NonNull",
"androidx.annotation.Nullable"
] | import androidx.annotation.NonNull; import androidx.annotation.Nullable; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 1,094,859 |
@Test(dataProvider = "invalid-header-data-provider")
public void testInvalidHeader(String header) {
Assert.assertNull(authenticator.authenticate(createAuthContext(header)));
} | @Test(dataProvider = STR) void function(String header) { Assert.assertNull(authenticator.authenticate(createAuthContext(header))); } | /**
* Test with various invalid authorization headers.
*
* @param header
* Invalid authorization header.
*/ | Test with various invalid authorization headers | testInvalidHeader | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/commons/commons-rest-security/src/test/java/com/sirma/itt/seip/rest/security/JwtParameterAuthenticatorTest.java",
"license": "lgpl-3.0",
"size": 5695
} | [
"org.testng.Assert",
"org.testng.annotations.Test"
] | import org.testng.Assert; import org.testng.annotations.Test; | import org.testng.*; import org.testng.annotations.*; | [
"org.testng",
"org.testng.annotations"
] | org.testng; org.testng.annotations; | 1,915,087 |
@Test
public void test1XSFHomeRemoveWithEnlistedKey() throws Exception {
// d171551 Begins
SFRa ejb2 = fhome2.create();
assertNotNull(" remove test, EJB instance creation.", ejb2);
try {
ejb2.homeRemovePKeyInTransaction();
fail(" Unexpected return from remove( ejb ).");
} catch (RemoveException re) { // See ejb 2.0 spec 6.3.2.pg 59
svLogger.info("Caught expected " + re.getClass().getName());
}
// d171551 Ends
} | void function() throws Exception { SFRa ejb2 = fhome2.create(); assertNotNull(STR, ejb2); try { ejb2.homeRemovePKeyInTransaction(); fail(STR); } catch (RemoveException re) { svLogger.info(STR + re.getClass().getName()); } } | /**
* (hrk03) Test Stateful home remove with enlisted primary key
*/ | (hrk03) Test Stateful home remove with enlisted primary key | test1XSFHomeRemoveWithEnlistedKey | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB1XRemoteSpecWeb.war/src/com/ibm/ejb1x/base/spec/sfr/web/SFRemoteHomeRemoveServlet.java",
"license": "epl-1.0",
"size": 7366
} | [
"com.ibm.ejb1x.base.spec.sfr.ejb.SFRa",
"javax.ejb.RemoveException",
"org.junit.Assert"
] | import com.ibm.ejb1x.base.spec.sfr.ejb.SFRa; import javax.ejb.RemoveException; import org.junit.Assert; | import com.ibm.ejb1x.base.spec.sfr.ejb.*; import javax.ejb.*; import org.junit.*; | [
"com.ibm.ejb1x",
"javax.ejb",
"org.junit"
] | com.ibm.ejb1x; javax.ejb; org.junit; | 2,465,990 |
public static String substitute(String text, Map<String, String> vars)
{
String retVal = null;
if (LOG.isDebugEnabled())
{
LOG.debug("Before:\n" + text);
}
Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}");
Matcher matcher = pattern.matcher(text);
StringBuffer buffer = new StringBuffer();
while (matcher.find())
{
String replacement = vars.get(matcher.group(1));
if (replacement != null)
{
matcher.appendReplacement(buffer, "");
//Recursively call itself to make sure the full value is expanded.
buffer.append(substitute(replacement, vars));
}
}
matcher.appendTail(buffer);
retVal = buffer.toString();
if (LOG.isDebugEnabled())
{
LOG.debug("After:\n" + retVal);
}
return retVal;
}
| static String function(String text, Map<String, String> vars) { String retVal = null; if (LOG.isDebugEnabled()) { LOG.debug(STR + text); } Pattern pattern = Pattern.compile(STR); Matcher matcher = pattern.matcher(text); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { String replacement = vars.get(matcher.group(1)); if (replacement != null) { matcher.appendReplacement(buffer, STRAfter:\n" + retVal); } return retVal; } | /**
* Substitutes the Map keys found in the given string with their corresponding values from the Map. It supports nested
* parameters as well. This means that if the resolved text again contains parameters it will resolve those as well.
*
* @param text The original text that should be checked and replaced.
* @param vars The replacements for the parameters in the source string.
* @return The replaced string.
*/ | Substitutes the Map keys found in the given string with their corresponding values from the Map. It supports nested parameters as well. This means that if the resolved text again contains parameters it will resolve those as well | substitute | {
"repo_name": "MarkHooijkaas/caas-cordys-svn",
"path": "src/java/org/kisst/cordys/caas/util/StringUtil.java",
"license": "gpl-3.0",
"size": 10070
} | [
"java.util.Map",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 288,271 |
public void invalidate(String bpid, ReplicaInfo block) {
// If a DFSClient has the replica in its cache of short-circuit file
// descriptors (and the client is using ShortCircuitShm), invalidate it.
// The short-circuit registry is null in the unit tests, because the
// datanode is mock object.
if (datanode.getShortCircuitRegistry() != null) {
datanode.getShortCircuitRegistry().processBlockInvalidation(
new ExtendedBlockId(block.getBlockId(), bpid));
// If the block is cached, start uncaching it.
cacheManager.uncacheBlock(bpid, block.getBlockId());
}
datanode.notifyNamenodeDeletedBlock(new ExtendedBlock(bpid, block),
block.getStorageUuid());
} | void function(String bpid, ReplicaInfo block) { if (datanode.getShortCircuitRegistry() != null) { datanode.getShortCircuitRegistry().processBlockInvalidation( new ExtendedBlockId(block.getBlockId(), bpid)); cacheManager.uncacheBlock(bpid, block.getBlockId()); } datanode.notifyNamenodeDeletedBlock(new ExtendedBlock(bpid, block), block.getStorageUuid()); } | /**
* Invalidate a block but does not delete the actual on-disk block file.
*
* It should only be used when deactivating disks.
*
* @param bpid the block pool ID.
* @param block The block to be invalidated.
*/ | Invalidate a block but does not delete the actual on-disk block file. It should only be used when deactivating disks | invalidate | {
"repo_name": "hash-X/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java",
"license": "apache-2.0",
"size": 114698
} | [
"org.apache.hadoop.hdfs.ExtendedBlockId",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock",
"org.apache.hadoop.hdfs.server.datanode.ReplicaInfo"
] | import org.apache.hadoop.hdfs.ExtendedBlockId; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo; | import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.datanode.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,400,440 |
public static DrillHiveMetaStoreClient createCloseableClientWithCaching(final HiveConf hiveConf)
throws MetaException {
return new DrillHiveMetaStoreClient(hiveConf);
} | static DrillHiveMetaStoreClient function(final HiveConf hiveConf) throws MetaException { return new DrillHiveMetaStoreClient(hiveConf); } | /**
* Create a DrillMetaStoreClient that can be shared across multiple users. This is created when impersonation is
* disabled.
*
* @param hiveConf hive properties set in Drill storage plugin
* @return instance of client
* @throws MetaException when initialization failed
*/ | Create a DrillMetaStoreClient that can be shared across multiple users. This is created when impersonation is disabled | createCloseableClientWithCaching | {
"repo_name": "apache/drill",
"path": "contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/client/DrillHiveMetaStoreClientFactory.java",
"license": "apache-2.0",
"size": 5984
} | [
"org.apache.hadoop.hive.conf.HiveConf",
"org.apache.hadoop.hive.metastore.api.MetaException"
] | import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.MetaException; | import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.metastore.api.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,967,088 |
public RangeDecomposition decomposeRange(
NumericData[] rangePerDimension,
CompactHilbertCurve compactHilbertCurve,
SFCDimensionDefinition[] dimensionDefinitions,
int totalPrecision,
int maxFilteredIndexedRanges,
boolean removeVacuum ); | RangeDecomposition function( NumericData[] rangePerDimension, CompactHilbertCurve compactHilbertCurve, SFCDimensionDefinition[] dimensionDefinitions, int totalPrecision, int maxFilteredIndexedRanges, boolean removeVacuum ); | /**
* Decompose the raw range per dimension values into an optimal set of
* compact Hilbert SFC ranges
*
* @param rangePerDimension
* the raw range per dimension
* @param compactHilbertCurve
* the compact Hilbert curve to use for the conversion
* @param dimensionDefinitions
* a set of dimension definitions to use to normalize the raw
* values
* @param totalPrecision
* the total precision of the dimension definitions, for
* convenience
* @param maxFilteredIndexedRanges
* the maximum number of ranges, if < 0 it will be unlimited
* @param removeVacuum
* a flag to pass to the compact hilbert curve range
* decomposition
* @return the optimal SFC range decomposition for the raw-valued ranges
*/ | Decompose the raw range per dimension values into an optimal set of compact Hilbert SFC ranges | decomposeRange | {
"repo_name": "ruks/geowave",
"path": "core/index/src/main/java/mil/nga/giat/geowave/core/index/sfc/hilbert/HilbertSFCOperations.java",
"license": "apache-2.0",
"size": 5235
} | [
"com.google.uzaygezen.core.CompactHilbertCurve",
"mil.nga.giat.geowave.core.index.sfc.RangeDecomposition",
"mil.nga.giat.geowave.core.index.sfc.SFCDimensionDefinition",
"mil.nga.giat.geowave.core.index.sfc.data.NumericData"
] | import com.google.uzaygezen.core.CompactHilbertCurve; import mil.nga.giat.geowave.core.index.sfc.RangeDecomposition; import mil.nga.giat.geowave.core.index.sfc.SFCDimensionDefinition; import mil.nga.giat.geowave.core.index.sfc.data.NumericData; | import com.google.uzaygezen.core.*; import mil.nga.giat.geowave.core.index.sfc.*; import mil.nga.giat.geowave.core.index.sfc.data.*; | [
"com.google.uzaygezen",
"mil.nga.giat"
] | com.google.uzaygezen; mil.nga.giat; | 620,928 |
DeleteResult deleteMany(Bson filter, DeleteOptions options); | DeleteResult deleteMany(Bson filter, DeleteOptions options); | /**
* Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
*
* @param filter the query filter to apply the delete operation
* @param options the options to apply to the delete operation
* @return the result of the remove many operation
* @throws com.mongodb.MongoWriteException if the write failed due to some specific write exception
* @throws com.mongodb.MongoWriteConcernException if the write failed due to being unable to fulfil the write concern
* @throws com.mongodb.MongoCommandException if the write failed due to a specific command exception
* @throws com.mongodb.MongoException if the write failed due some other failure
* @since 3.4
*/ | Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified | deleteMany | {
"repo_name": "rozza/mongo-java-driver",
"path": "driver-sync/src/main/com/mongodb/client/MongoCollection.java",
"license": "apache-2.0",
"size": 102106
} | [
"com.mongodb.client.model.DeleteOptions",
"com.mongodb.client.result.DeleteResult",
"org.bson.conversions.Bson"
] | import com.mongodb.client.model.DeleteOptions; import com.mongodb.client.result.DeleteResult; import org.bson.conversions.Bson; | import com.mongodb.client.model.*; import com.mongodb.client.result.*; import org.bson.conversions.*; | [
"com.mongodb.client",
"org.bson.conversions"
] | com.mongodb.client; org.bson.conversions; | 1,841,016 |
return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
} | return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } | /**
* Generates a password.
*
* @return the generated password
*/ | Generates a password | generatePassword | {
"repo_name": "onpointtech/stack-reference",
"path": "src/main/java/com/onpoint/service/util/RandomUtil.java",
"license": "apache-2.0",
"size": 683
} | [
"org.apache.commons.lang.RandomStringUtils"
] | import org.apache.commons.lang.RandomStringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,230,885 |
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
logger.log(Level.INFO, "AuthenticationServlet#doGet() called");
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType(MediaType.TEXT_HTML);
try (PrintWriter writer = response.getWriter()) {
writer.println("&&&&&&&&&&&&&& GET request acknowledged &&&&&&&&&&&&&&&&&&&&&");
writer.flush();
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.log(Level.INFO, STR); response.setStatus(HttpServletResponse.SC_OK); response.setContentType(MediaType.TEXT_HTML); try (PrintWriter writer = response.getWriter()) { writer.println(STR); writer.flush(); } } | /**
* Handles the HTTP <code>GET</code> method. Returns basic http 200 'ok'
* response code
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>GET</code> method. Returns basic http 200 'ok' response code | doGet | {
"repo_name": "GEOINT/keyhole",
"path": "src/test/java/org/geoint/keyhole/test/AuthenticationServlet.java",
"license": "apache-2.0",
"size": 4258
} | [
"java.io.IOException",
"java.io.PrintWriter",
"java.util.logging.Level",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.ws.rs.core.MediaType"
] | import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.MediaType; | import java.io.*; import java.util.logging.*; import javax.servlet.*; import javax.servlet.http.*; import javax.ws.rs.core.*; | [
"java.io",
"java.util",
"javax.servlet",
"javax.ws"
] | java.io; java.util; javax.servlet; javax.ws; | 2,589,669 |
public void deleteApplication(int id) {
Application appPersistent = daoService.getApplicationById(id);
logger.info("removing application " + id + " " + appPersistent.getName());
daoService.deleteApplication(appPersistent);
}
| void function(int id) { Application appPersistent = daoService.getApplicationById(id); logger.info(STR + id + " " + appPersistent.getName()); daoService.deleteApplication(appPersistent); } | /**
* Deletes the application.
*
* @param uiApplication
*/ | Deletes the application | deleteApplication | {
"repo_name": "EsupPortail/esup-smsu-api-admin",
"path": "src/main/java/org/esupportail/smsuapiadmin/business/ApplicationManager.java",
"license": "apache-2.0",
"size": 3267
} | [
"org.esupportail.smsuapi.dao.beans.Application"
] | import org.esupportail.smsuapi.dao.beans.Application; | import org.esupportail.smsuapi.dao.beans.*; | [
"org.esupportail.smsuapi"
] | org.esupportail.smsuapi; | 1,708,934 |
private void throwOrWarnAboutDescriptorProblem(String message) {
if (validateDescriptions) {
throw new IllegalArgumentException(message);
}
ControllerLogger.ROOT_LOGGER.warn(message);
} | void function(String message) { if (validateDescriptions) { throw new IllegalArgumentException(message); } ControllerLogger.ROOT_LOGGER.warn(message); } | /**
* Throws an exception or logs a message
*
* @param message The message for the exception or the log message. Must be internationalized
*/ | Throws an exception or logs a message | throwOrWarnAboutDescriptorProblem | {
"repo_name": "aloubyansky/wildfly-core",
"path": "controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java",
"license": "lgpl-2.1",
"size": 30232
} | [
"org.jboss.as.controller.logging.ControllerLogger"
] | import org.jboss.as.controller.logging.ControllerLogger; | import org.jboss.as.controller.logging.*; | [
"org.jboss.as"
] | org.jboss.as; | 1,779,807 |
@Override
public void onFailure(IMqttToken token, Throwable throwable) {
Log.e(TAG, ".onFailure() entered");
switch (action) {
case CONNECTING:
handleConnectFailure(throwable);
break;
case SUBSCRIBE:
handleSubscribeFailure(throwable);
break;
case PUBLISH:
handlePublishFailure(throwable);
break;
case DISCONNECTING:
handleDisconnectFailure(throwable);
break;
default:
break;
}
} | void function(IMqttToken token, Throwable throwable) { Log.e(TAG, STR); switch (action) { case CONNECTING: handleConnectFailure(throwable); break; case SUBSCRIBE: handleSubscribeFailure(throwable); break; case PUBLISH: handlePublishFailure(throwable); break; case DISCONNECTING: handleDisconnectFailure(throwable); break; default: break; } } | /**
* Determine the type of callback that failed.
* @param token The MQTT Token for the completed action.
* @param throwable The exception corresponding to the failure.
*/ | Determine the type of callback that failed | onFailure | {
"repo_name": "markusvankempen/IBMIotForAndriod",
"path": "src/com/ibm/demo/IoTStarter/utils/ActionListener.java",
"license": "epl-1.0",
"size": 7019
} | [
"android.util.Log",
"org.eclipse.paho.client.mqttv3.IMqttToken"
] | import android.util.Log; import org.eclipse.paho.client.mqttv3.IMqttToken; | import android.util.*; import org.eclipse.paho.client.mqttv3.*; | [
"android.util",
"org.eclipse.paho"
] | android.util; org.eclipse.paho; | 518,115 |
public interface protection_managementPersistence extends BasePersistence<protection_management> {
public void cacheResult(
com.iucn.whp.dbservice.model.protection_management protection_management); | interface protection_managementPersistence extends BasePersistence<protection_management> { public void function( com.iucn.whp.dbservice.model.protection_management protection_management); | /**
* Caches the protection_management in the entity cache if it is enabled.
*
* @param protection_management the protection_management
*/ | Caches the protection_management in the entity cache if it is enabled | cacheResult | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/service/com/iucn/whp/dbservice/service/persistence/protection_managementPersistence.java",
"license": "gpl-2.0",
"size": 14693
} | [
"com.liferay.portal.service.persistence.BasePersistence"
] | import com.liferay.portal.service.persistence.BasePersistence; | import com.liferay.portal.service.persistence.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 1,531,834 |
public QueryCondition in(FieldPath path, List<? extends Object> listOfValue); | QueryCondition function(FieldPath path, List<? extends Object> listOfValue); | /**
* Adds a condition that tests if the {@code Value} at the specified
* {@code FieldPath} is equal to at least one of the values in the
* specified {@code List}.
*
* @param path the {@code FieldPath} to test
* @param listOfValue the {@code List} of values to test against
* @return {@code this} for chained invocation
*/ | Adds a condition that tests if the Value at the specified FieldPath is equal to at least one of the values in the specified List | in | {
"repo_name": "jackhammer/jackhammer",
"path": "core/src/main/java/org/ojai/store/QueryCondition.java",
"license": "apache-2.0",
"size": 32028
} | [
"java.util.List",
"org.ojai.FieldPath"
] | import java.util.List; import org.ojai.FieldPath; | import java.util.*; import org.ojai.*; | [
"java.util",
"org.ojai"
] | java.util; org.ojai; | 2,097,385 |
public void setValue1( String value )
{
if ( value == null )
{
setProperty( VALUE1_MEMBER, null );
return;
}
List valueList = new ArrayList( );
valueList.add( value );
setProperty( VALUE1_MEMBER, valueList );
} | void function( String value ) { if ( value == null ) { setProperty( VALUE1_MEMBER, null ); return; } List valueList = new ArrayList( ); valueList.add( value ); setProperty( VALUE1_MEMBER, valueList ); } | /**
* Set expression for the first operand.
*
* @param value
* the first operand expression.
*/ | Set expression for the first operand | setValue1 | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/structures/StyleRule.java",
"license": "epl-1.0",
"size": 9305
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,293,840 |
protected List<AnnotationData> getAnnotationToSave() { return null; } | protected List<AnnotationData> getAnnotationToSave() { return null; } | /**
* No implementation in this case.
* @see AnnotationUI#getAnnotationToRemove()
*/ | No implementation in this case | getAnnotationToRemove | {
"repo_name": "joansmith/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/PropertiesUI.java",
"license": "gpl-2.0",
"size": 47623
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 813,301 |
public static int[] splitGt(String gt) {
try {
final int gtlen = gt.length();
if (gtlen == 1) { // Typical haploid call
return new int[]{alleleId(gt.charAt(0))};
} else {
int[] result = new int[2]; // Initialize assuming the most common case, diploid, and resize if needed
int ploid = 0;
int allelestart = 0;
for (int i = 0; i < gtlen; ++i) {
final char c = gt.charAt(i);
if (c == PHASED_SEPARATOR || c == UNPHASED_SEPARATOR) {
if (ploid == result.length) { // More than diploid call!
result = Arrays.copyOf(result, result.length + 1);
}
result[ploid++] = alleleId(gt, allelestart, i - allelestart);
allelestart = i + 1;
}
}
if (allelestart < gtlen) {
if (ploid == result.length) { // More than diploid call!
result = Arrays.copyOf(result, result.length + 1);
}
result[ploid++] = alleleId(gt, allelestart, gtlen - allelestart);
}
if (ploid < result.length) { // Can only happen if a haploid genotype with allele id > 9
result = Arrays.copyOf(result, ploid);
}
if (ploid == 0) {
throw new NumberFormatException();
}
return result;
}
} catch (NumberFormatException e) {
throw new VcfFormatException("Malformed VCF GT value \"" + gt + "\"");
}
} | static int[] function(String gt) { try { final int gtlen = gt.length(); if (gtlen == 1) { return new int[]{alleleId(gt.charAt(0))}; } else { int[] result = new int[2]; int ploid = 0; int allelestart = 0; for (int i = 0; i < gtlen; ++i) { final char c = gt.charAt(i); if (c == PHASED_SEPARATOR c == UNPHASED_SEPARATOR) { if (ploid == result.length) { result = Arrays.copyOf(result, result.length + 1); } result[ploid++] = alleleId(gt, allelestart, i - allelestart); allelestart = i + 1; } } if (allelestart < gtlen) { if (ploid == result.length) { result = Arrays.copyOf(result, result.length + 1); } result[ploid++] = alleleId(gt, allelestart, gtlen - allelestart); } if (ploid < result.length) { result = Arrays.copyOf(result, ploid); } if (ploid == 0) { throw new NumberFormatException(); } return result; } } catch (NumberFormatException e) { throw new VcfFormatException(STRSTR\""); } } | /**
* Utility method for splitting a VCF genotype subfield into an array of
* numeric allele identifiers.
*
* @param gt a VCF genotype subfield (the <code>GT</code> value).
* @return a new <code>int[]</code> containing one int per allele. Any missing values ('.') will be assigned index -1.
* @throws NumberFormatException if the subfield is malformed.
*/ | Utility method for splitting a VCF genotype subfield into an array of numeric allele identifiers | splitGt | {
"repo_name": "RealTimeGenomics/rtg-tools",
"path": "src/com/rtg/vcf/VcfUtils.java",
"license": "bsd-2-clause",
"size": 35156
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 604,751 |
@Click(R.id.estate_feedback_back)
void back() {
if (CheckDoubleClick.isFastDoubleClick()){
return ;
}
remove();
} | @Click(R.id.estate_feedback_back) void back() { if (CheckDoubleClick.isFastDoubleClick()){ return ; } remove(); } | /**
* Back to the previous fragment.
*/ | Back to the previous fragment | back | {
"repo_name": "bestarandyan/ShoppingMall",
"path": "BestarProject/ShoppingMall/src/com/manyi/mall/user/EstateFeedbackFragment.java",
"license": "apache-2.0",
"size": 4583
} | [
"com.huoqiu.framework.util.CheckDoubleClick",
"org.androidannotations.annotations.Click"
] | import com.huoqiu.framework.util.CheckDoubleClick; import org.androidannotations.annotations.Click; | import com.huoqiu.framework.util.*; import org.androidannotations.annotations.*; | [
"com.huoqiu.framework",
"org.androidannotations.annotations"
] | com.huoqiu.framework; org.androidannotations.annotations; | 1,400,798 |
private String decrypt(JSONArray jsonArray) throws IllegalBlockSizeException,
BadPaddingException, UnsupportedEncodingException, InvalidKeyException,
NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException, JSONException {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, getCiperKey(Base64.decodeBase64(jsonArray.getString(0).getBytes("UTF-8"))), new IvParameterSpec(Base64.decodeBase64(jsonArray.getString(1).getBytes("UTF-8"))));
return new String(cipher.doFinal(Base64.decodeBase64(jsonArray.getString(2).getBytes("UTF-8"))));
} | String function(JSONArray jsonArray) throws IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException, JSONException { Cipher cipher = Cipher.getInstance(STR); cipher.init(Cipher.DECRYPT_MODE, getCiperKey(Base64.decodeBase64(jsonArray.getString(0).getBytes("UTF-8"))), new IvParameterSpec(Base64.decodeBase64(jsonArray.getString(1).getBytes("UTF-8")))); return new String(cipher.doFinal(Base64.decodeBase64(jsonArray.getString(2).getBytes("UTF-8")))); } | /**
* Decrypt the body.
*
* @param jsonArray the encrypted payload
* @return the decrypted payload.
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws UnsupportedEncodingException
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
* @throws NoSuchPaddingException
* @throws InvalidKeySpecException
* @throws InvalidAlgorithmParameterException
* @throws JSONException
*/ | Decrypt the body | decrypt | {
"repo_name": "mikibrv/sling",
"path": "bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyRequestValidator.java",
"license": "apache-2.0",
"size": 22153
} | [
"java.io.UnsupportedEncodingException",
"java.security.InvalidAlgorithmParameterException",
"java.security.InvalidKeyException",
"java.security.NoSuchAlgorithmException",
"java.security.spec.InvalidKeySpecException",
"javax.crypto.BadPaddingException",
"javax.crypto.Cipher",
"javax.crypto.IllegalBlockSizeException",
"javax.crypto.NoSuchPaddingException",
"javax.crypto.spec.IvParameterSpec",
"org.apache.commons.codec.binary.Base64",
"org.apache.sling.commons.json.JSONArray",
"org.apache.sling.commons.json.JSONException"
] | import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import org.apache.commons.codec.binary.Base64; import org.apache.sling.commons.json.JSONArray; import org.apache.sling.commons.json.JSONException; | import java.io.*; import java.security.*; import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*; import org.apache.commons.codec.binary.*; import org.apache.sling.commons.json.*; | [
"java.io",
"java.security",
"javax.crypto",
"org.apache.commons",
"org.apache.sling"
] | java.io; java.security; javax.crypto; org.apache.commons; org.apache.sling; | 2,061,127 |
@SuppressWarnings("unchecked")
public B handler(ChannelHandler handler) {
if (handler == null) {
throw new NullPointerException("handler");
}
this.handler = handler;
return (B) this;
} | @SuppressWarnings(STR) B function(ChannelHandler handler) { if (handler == null) { throw new NullPointerException(STR); } this.handler = handler; return (B) this; } | /**
* the {@link ChannelHandler} to use for serving the requests.
*/ | the <code>ChannelHandler</code> to use for serving the requests | handler | {
"repo_name": "drowning/netty",
"path": "transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java",
"license": "apache-2.0",
"size": 16918
} | [
"io.netty.channel.ChannelHandler"
] | import io.netty.channel.ChannelHandler; | import io.netty.channel.*; | [
"io.netty.channel"
] | io.netty.channel; | 608,841 |
private boolean alreadyInSave = false;
public void save(Connection con) throws TorqueException
{
if (!alreadyInSave)
{
alreadyInSave = true;
// If this object has been modified, then save it to the database.
if (isModified())
{
if (isNew())
{
TPpriorityPeer.doInsert((TPpriority) this, con);
setNew(false);
}
else
{
TPpriorityPeer.doUpdate((TPpriority) this, con);
}
}
alreadyInSave = false;
}
} | boolean alreadyInSave = false; public void function(Connection con) throws TorqueException { if (!alreadyInSave) { alreadyInSave = true; if (isModified()) { if (isNew()) { TPpriorityPeer.doInsert((TPpriority) this, con); setNew(false); } else { TPpriorityPeer.doUpdate((TPpriority) this, con); } } alreadyInSave = false; } } | /**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* is meant to be used as part of a transaction, otherwise use
* the save() method and the connection details will be handled
* internally
*
* @param con
* @throws TorqueException
*/ | Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. This method is meant to be used as part of a transaction, otherwise use the save() method and the connection details will be handled internally | save | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTPpriority.java",
"license": "gpl-3.0",
"size": 31826
} | [
"java.sql.Connection",
"org.apache.torque.TorqueException"
] | import java.sql.Connection; import org.apache.torque.TorqueException; | import java.sql.*; import org.apache.torque.*; | [
"java.sql",
"org.apache.torque"
] | java.sql; org.apache.torque; | 2,351,671 |
public void addLock(String user, Version vernum)
throws InvalidVersionNumberException, NodeNotFoundException
{
addUser(user);
Node node = newNode(vernum);
node.setLocker(user);
if (user == null)
{
locked.remove(node);
}
else
{
locked.add(node);
}
}
| void function(String user, Version vernum) throws InvalidVersionNumberException, NodeNotFoundException { addUser(user); Node node = newNode(vernum); node.setLocker(user); if (user == null) { locked.remove(node); } else { locked.add(node); } } | /**
* Add a lock over a revison.
*
* @param user
* The user that locks the revision.
* @param vernum
* The version number of the revision to lock.
*/ | Add a lock over a revison | addLock | {
"repo_name": "tarzanek/jrcs",
"path": "src/java/org/suigeneris/jrcs/rcs/Archive.java",
"license": "lgpl-2.1",
"size": 52938
} | [
"org.suigeneris.jrcs.rcs.impl.Node",
"org.suigeneris.jrcs.rcs.impl.NodeNotFoundException"
] | import org.suigeneris.jrcs.rcs.impl.Node; import org.suigeneris.jrcs.rcs.impl.NodeNotFoundException; | import org.suigeneris.jrcs.rcs.impl.*; | [
"org.suigeneris.jrcs"
] | org.suigeneris.jrcs; | 2,796,366 |
public boolean isStringType()
{
switch (typeId.getJDBCTypeId())
{
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.CLOB:
return true;
default:
return false;
}
} | boolean function() { switch (typeId.getJDBCTypeId()) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.CLOB: return true; default: return false; } } | /**
* Report whether this type is a string type.
*/ | Report whether this type is a string type | isStringType | {
"repo_name": "splicemachine/spliceengine",
"path": "db-engine/src/main/java/com/splicemachine/db/catalog/types/TypeDescriptorImpl.java",
"license": "agpl-3.0",
"size": 27826
} | [
"java.sql.Types"
] | import java.sql.Types; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,067,954 |
void updateCachedLocations(TableName tableName, byte[] rowkey,
Object exception, ServerName source); | void updateCachedLocations(TableName tableName, byte[] rowkey, Object exception, ServerName source); | /**
* Update the location cache. This is used internally by HBase, in most cases it should not be
* used by the client application.
* @param tableName the table name
* @param rowkey the row
* @param exception the exception if any. Can be null.
* @param source the previous location
*/ | Update the location cache. This is used internally by HBase, in most cases it should not be used by the client application | updateCachedLocations | {
"repo_name": "intel-hadoop/hbase-rhino",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java",
"license": "apache-2.0",
"size": 7832
} | [
"org.apache.hadoop.hbase.ServerName",
"org.apache.hadoop.hbase.TableName"
] | import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 86,498 |
private void moveGroupSiblings(Relationship sRel, int targetGroup) {
//Find all the group siblings of this stated relationship
List<Relationship> statedSiblings = sRel.getSourceConcept().findMatchingRelationships(sRel.getGroup(), true);
//For each one that's not the current relationship, try and find an inferred match (on Type + Destination, Type + more proximate destination,
//more proximate type + destination, both more proximate) in that same target group
Concept inferredSource = Concept.getConcept(sRel.getSourceId(), CHARACTERISTIC.INFERRED);
for (Relationship statedSibling : statedSiblings) {
if (!statedSibling.equals(sRel)) {
List<Relationship> potentialMatches = inferredSource.findMatchingRelationships(statedSibling.getTypeId(),
statedSibling.getDestinationId(), targetGroup, true, true);
if (potentialMatches.size() > 0) {
// We will not "try" this replacement because group moves take priority
statedSibling.setReplacement(potentialMatches.get(0), "AlgMGS");
}
}
}
} | void function(Relationship sRel, int targetGroup) { List<Relationship> statedSiblings = sRel.getSourceConcept().findMatchingRelationships(sRel.getGroup(), true); Concept inferredSource = Concept.getConcept(sRel.getSourceId(), CHARACTERISTIC.INFERRED); for (Relationship statedSibling : statedSiblings) { if (!statedSibling.equals(sRel)) { List<Relationship> potentialMatches = inferredSource.findMatchingRelationships(statedSibling.getTypeId(), statedSibling.getDestinationId(), targetGroup, true, true); if (potentialMatches.size() > 0) { statedSibling.setReplacement(potentialMatches.get(0), STR); } } } } | /**
* When one relationship in a stated group moves group, try to move all it's siblings together EVEN IF that relationship has already
* been replaced - keeping siblings together in a group is paramount, and trumps other apparently better matches eg exact triple matches
* in other groups.
*/ | When one relationship in a stated group moves group, try to move all it's siblings together EVEN IF that relationship has already been replaced - keeping siblings together in a group is paramount, and trumps other apparently better matches eg exact triple matches in other groups | moveGroupSiblings | {
"repo_name": "IHTSDO/snomed-utilities",
"path": "src/main/java/org/ihtsdo/snomed/util/rf2/srsi/RelationshipProcessor.java",
"license": "apache-2.0",
"size": 21808
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 721,058 |
@Nullable
public WorkbookFunctionResult post() throws ClientException {
return send(HttpMethod.POST, body);
} | WorkbookFunctionResult function() throws ClientException { return send(HttpMethod.POST, body); } | /**
* Invokes the method and returns the result
* @return result of the method invocation
* @throws ClientException an exception occurs if there was an error while the request was sent
*/ | Invokes the method and returns the result | post | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/WorkbookFunctionsExactRequest.java",
"license": "mit",
"size": 2965
} | [
"com.microsoft.graph.core.ClientException",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.WorkbookFunctionResult"
] | import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.WorkbookFunctionResult; | import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 397,721 |
public static Criterion contains(TimePrimitiveFieldDescriptor property, Time value)
throws UnsupportedTimeException {
return filter(new ContainsRestriction(), property, value);
} | static Criterion function(TimePrimitiveFieldDescriptor property, Time value) throws UnsupportedTimeException { return filter(new ContainsRestriction(), property, value); } | /**
* Creates a temporal restriction for the specified time and property.
*
* @param property
* the property
* @param value
* the value
*
* @return the <tt>Criterion</tt>
*
* @see ContainsRestriction
* @throws UnsupportedTimeException
* if the value and property combination is not applicable for
* this restriction
*/ | Creates a temporal restriction for the specified time and property | contains | {
"repo_name": "impulze/SOS",
"path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/TemporalRestrictions.java",
"license": "gpl-2.0",
"size": 39623
} | [
"org.hibernate.criterion.Criterion",
"org.n52.sos.ds.hibernate.util.TemporalRestriction",
"org.n52.sos.exception.ows.concrete.UnsupportedTimeException",
"org.n52.sos.ogc.gml.time.Time"
] | import org.hibernate.criterion.Criterion; import org.n52.sos.ds.hibernate.util.TemporalRestriction; import org.n52.sos.exception.ows.concrete.UnsupportedTimeException; import org.n52.sos.ogc.gml.time.Time; | import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.exception.ows.concrete.*; import org.n52.sos.ogc.gml.time.*; | [
"org.hibernate.criterion",
"org.n52.sos"
] | org.hibernate.criterion; org.n52.sos; | 2,497,854 |
private PlayerAuth getPlayerAuth(Player player) {
final String name = player.getName().toLowerCase();
if (playerCache.isAuthenticated(name)) {
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
return null;
}
PlayerAuth auth = dataSource.getAuth(name);
if (auth == null) {
service.send(player, MessageKey.UNKNOWN_USER);
// Recreate the message task to immediately send the message again as response
// and to make sure we send the right register message (password vs. email registration)
limboPlayerTaskManager.registerMessageTask(name, false);
return null;
}
if (!service.getProperty(DatabaseSettings.MYSQL_COL_GROUP).isEmpty()
&& auth.getGroupId() == service.getProperty(HooksSettings.NON_ACTIVATED_USERS_GROUP)) {
service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED);
return null;
}
final String ip = PlayerUtils.getPlayerIp(player);
if (hasReachedMaxLoggedInPlayersForIp(player, ip)) {
service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
return null;
}
boolean isAsync = service.getProperty(PluginSettings.USE_ASYNC_TASKS);
AuthMeAsyncPreLoginEvent event = new AuthMeAsyncPreLoginEvent(player, isAsync);
bukkitService.callEvent(event);
if (!event.canLogin()) {
return null;
}
return auth;
} | PlayerAuth function(Player player) { final String name = player.getName().toLowerCase(); if (playerCache.isAuthenticated(name)) { service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR); return null; } PlayerAuth auth = dataSource.getAuth(name); if (auth == null) { service.send(player, MessageKey.UNKNOWN_USER); limboPlayerTaskManager.registerMessageTask(name, false); return null; } if (!service.getProperty(DatabaseSettings.MYSQL_COL_GROUP).isEmpty() && auth.getGroupId() == service.getProperty(HooksSettings.NON_ACTIVATED_USERS_GROUP)) { service.send(player, MessageKey.ACCOUNT_NOT_ACTIVATED); return null; } final String ip = PlayerUtils.getPlayerIp(player); if (hasReachedMaxLoggedInPlayersForIp(player, ip)) { service.send(player, MessageKey.ALREADY_LOGGED_IN_ERROR); return null; } boolean isAsync = service.getProperty(PluginSettings.USE_ASYNC_TASKS); AuthMeAsyncPreLoginEvent event = new AuthMeAsyncPreLoginEvent(player, isAsync); bukkitService.callEvent(event); if (!event.canLogin()) { return null; } return auth; } | /**
* Checks the precondition for authentication (like user known) and returns
* the player's {@link PlayerAuth} object.
*
* @return the PlayerAuth object, or {@code null} if the player doesn't exist or may not log in
* (e.g. because he is already logged in)
*/ | Checks the precondition for authentication (like user known) and returns the player's <code>PlayerAuth</code> object | getPlayerAuth | {
"repo_name": "Krokit/AuthMeReloaded",
"path": "src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java",
"license": "gpl-3.0",
"size": 13184
} | [
"fr.xephi.authme.data.auth.PlayerAuth",
"fr.xephi.authme.events.AuthMeAsyncPreLoginEvent",
"fr.xephi.authme.message.MessageKey",
"fr.xephi.authme.settings.properties.DatabaseSettings",
"fr.xephi.authme.settings.properties.HooksSettings",
"fr.xephi.authme.settings.properties.PluginSettings",
"fr.xephi.authme.util.PlayerUtils",
"org.bukkit.entity.Player"
] | import fr.xephi.authme.data.auth.PlayerAuth; import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent; import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.util.PlayerUtils; import org.bukkit.entity.Player; | import fr.xephi.authme.data.auth.*; import fr.xephi.authme.events.*; import fr.xephi.authme.message.*; import fr.xephi.authme.settings.properties.*; import fr.xephi.authme.util.*; import org.bukkit.entity.*; | [
"fr.xephi.authme",
"org.bukkit.entity"
] | fr.xephi.authme; org.bukkit.entity; | 532,503 |
private static int getY(View view) {
int y = 0;
while (view != null) {
y += (int) view.getY();
view = (View) view.getParent();
}
return y;
} | static int function(View view) { int y = 0; while (view != null) { y += (int) view.getY(); view = (View) view.getParent(); } return y; } | /**
* Returns the y coordinates of a view by tracing up its hierarchy.
*/ | Returns the y coordinates of a view by tracing up its hierarchy | getY | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/UnifiedEmail/src/com/android/mail/browse/ConversationItemViewCoordinates.java",
"license": "gpl-3.0",
"size": 16734
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,624,906 |
public static void sendDocumentList(JCoDestination destination, DocumentList documentList, String tid) throws Exception {
IDocRepository iDocRepository = JCoIDoc.getIDocRepository(destination);
IDocFactory iDocFactory = JCoIDoc.getIDocFactory();
// Create IDoc
IDocDocumentList iDocDocumentList = iDocFactory.createIDocDocumentList(iDocRepository, documentList.getIdocType(), documentList.getIdocTypeExtension(),
documentList.getSystemRelease(), documentList.getApplicationRelease());
// Fill IDoc Document
fillIDocDocumentListFromDocumentList(documentList, iDocDocumentList);
// Send IDoc
JCoIDoc.send(iDocDocumentList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);
} | static void function(JCoDestination destination, DocumentList documentList, String tid) throws Exception { IDocRepository iDocRepository = JCoIDoc.getIDocRepository(destination); IDocFactory iDocFactory = JCoIDoc.getIDocFactory(); IDocDocumentList iDocDocumentList = iDocFactory.createIDocDocumentList(iDocRepository, documentList.getIdocType(), documentList.getIdocTypeExtension(), documentList.getSystemRelease(), documentList.getApplicationRelease()); fillIDocDocumentListFromDocumentList(documentList, iDocDocumentList); JCoIDoc.send(iDocDocumentList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid); } | /**
* Send <code>documentList</code> to <code>destination</code>.
*
* @param destination
* - the destination to send to.
* @param documentList
* - the document list to send.
* @param tid
* - the transaction ID to use.
* @throws Exception
*/ | Send <code>documentList</code> to <code>destination</code> | sendDocumentList | {
"repo_name": "DaemonSu/fuse-master",
"path": "components/camel-sap/org.fusesource.camel.component.sap/src/org/fusesource/camel/component/sap/util/IDocUtil.java",
"license": "apache-2.0",
"size": 58577
} | [
"com.sap.conn.idoc.IDocDocumentList",
"com.sap.conn.idoc.IDocFactory",
"com.sap.conn.idoc.IDocRepository",
"com.sap.conn.idoc.jco.JCoIDoc",
"com.sap.conn.jco.JCoDestination",
"org.fusesource.camel.component.sap.model.idoc.DocumentList"
] | import com.sap.conn.idoc.IDocDocumentList; import com.sap.conn.idoc.IDocFactory; import com.sap.conn.idoc.IDocRepository; import com.sap.conn.idoc.jco.JCoIDoc; import com.sap.conn.jco.JCoDestination; import org.fusesource.camel.component.sap.model.idoc.DocumentList; | import com.sap.conn.idoc.*; import com.sap.conn.idoc.jco.*; import com.sap.conn.jco.*; import org.fusesource.camel.component.sap.model.idoc.*; | [
"com.sap.conn",
"org.fusesource.camel"
] | com.sap.conn; org.fusesource.camel; | 2,456,708 |
public static Exchange copyExchangeAndSetCamelContext(Exchange exchange, CamelContext context) {
return copyExchangeAndSetCamelContext(exchange, context, true);
} | static Exchange function(Exchange exchange, CamelContext context) { return copyExchangeAndSetCamelContext(exchange, context, true); } | /**
* Copies the exchange but the copy will be tied to the given context
*
* @param exchange the source exchange
* @param context the camel context
* @return a copy with the given camel context
*/ | Copies the exchange but the copy will be tied to the given context | copyExchangeAndSetCamelContext | {
"repo_name": "zregvart/camel",
"path": "core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java",
"license": "apache-2.0",
"size": 42299
} | [
"org.apache.camel.CamelContext",
"org.apache.camel.Exchange"
] | import org.apache.camel.CamelContext; import org.apache.camel.Exchange; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 661,546 |
@Test
public void testWampler2() {
double[] data = new double[] {
1.00000, 0,
1.11111, 1,
1.24992, 2,
1.42753, 3,
1.65984, 4,
1.96875, 5,
2.38336, 6,
2.94117, 7,
3.68928, 8,
4.68559, 9,
6.00000, 10,
7.71561, 11,
9.92992, 12,
12.75603, 13,
16.32384, 14,
20.78125, 15,
26.29536, 16,
33.05367, 17,
41.26528, 18,
51.16209, 19,
63.00000, 20};
OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression();
final int nvars = 5;
final int nobs = 21;
double[] tmp = new double[(nvars + 1) * nobs];
int off = 0;
int off2 = 0;
for (int i = 0; i < nobs; i++) {
tmp[off2] = data[off];
tmp[off2 + 1] = data[off + 1];
tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1];
tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2];
tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3];
tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4];
off2 += (nvars + 1);
off += 2;
}
mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix());
double[] betaHat = mdl.estimateRegressionParameters();
TestUtils.assertEquals(betaHat,
new double[] {
1.0,
1.0e-1,
1.0e-2,
1.0e-3, 1.0e-4,
1.0e-5}, 1E-8);
double[] se = mdl.estimateRegressionParametersStandardErrors();
TestUtils.assertEquals(se,
new double[] {
0.0,
0.0, 0.0,
0.0, 0.0,
0.0}, 1E-8);
TestUtils.assertEquals(1.0, mdl.calculateRSquared(), 1.0e-10);
TestUtils.assertEquals(0, mdl.estimateErrorVariance(), 1.0e-7);
TestUtils.assertEquals(0.00, mdl.calculateResidualSumOfSquares(), 1.0e-6);
} | void function() { double[] data = new double[] { 1.00000, 0, 1.11111, 1, 1.24992, 2, 1.42753, 3, 1.65984, 4, 1.96875, 5, 2.38336, 6, 2.94117, 7, 3.68928, 8, 4.68559, 9, 6.00000, 10, 7.71561, 11, 9.92992, 12, 12.75603, 13, 16.32384, 14, 20.78125, 15, 26.29536, 16, 33.05367, 17, 41.26528, 18, 51.16209, 19, 63.00000, 20}; OLSMultipleLinearRegression mdl = new OLSMultipleLinearRegression(); final int nvars = 5; final int nobs = 21; double[] tmp = new double[(nvars + 1) * nobs]; int off = 0; int off2 = 0; for (int i = 0; i < nobs; i++) { tmp[off2] = data[off]; tmp[off2 + 1] = data[off + 1]; tmp[off2 + 2] = tmp[off2 + 1] * tmp[off2 + 1]; tmp[off2 + 3] = tmp[off2 + 1] * tmp[off2 + 2]; tmp[off2 + 4] = tmp[off2 + 1] * tmp[off2 + 3]; tmp[off2 + 5] = tmp[off2 + 1] * tmp[off2 + 4]; off2 += (nvars + 1); off += 2; } mdl.newSampleData(tmp, nobs, nvars, new DenseLocalOnHeapMatrix()); double[] betaHat = mdl.estimateRegressionParameters(); TestUtils.assertEquals(betaHat, new double[] { 1.0, 1.0e-1, 1.0e-2, 1.0e-3, 1.0e-4, 1.0e-5}, 1E-8); double[] se = mdl.estimateRegressionParametersStandardErrors(); TestUtils.assertEquals(se, new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 1E-8); TestUtils.assertEquals(1.0, mdl.calculateRSquared(), 1.0e-10); TestUtils.assertEquals(0, mdl.estimateErrorVariance(), 1.0e-7); TestUtils.assertEquals(0.00, mdl.calculateResidualSumOfSquares(), 1.0e-6); } | /**
* This is a test based on the Wampler2 data set
* http://www.itl.nist.gov/div898/strd/lls/data/Wampler2.shtml
*/ | This is a test based on the Wampler2 data set HREF | testWampler2 | {
"repo_name": "dream-x/ignite",
"path": "modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java",
"license": "apache-2.0",
"size": 31715
} | [
"org.apache.ignite.ml.TestUtils",
"org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix"
] | import org.apache.ignite.ml.TestUtils; import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix; | import org.apache.ignite.ml.*; import org.apache.ignite.ml.math.impls.matrix.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,122,441 |
public ServiceFuture<PrivateLinkServiceInner> getByResourceGroupAsync(String resourceGroupName, String serviceName, final ServiceCallback<PrivateLinkServiceInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback);
} | ServiceFuture<PrivateLinkServiceInner> function(String resourceGroupName, String serviceName, final ServiceCallback<PrivateLinkServiceInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); } | /**
* Gets the specified private link service by resource group.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the private link service.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Gets the specified private link service by resource group | getByResourceGroupAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/PrivateLinkServicesInner.java",
"license": "mit",
"size": 162539
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,327,102 |
boolean destroyDependentInstance(T instance);
/**
* Register a {@link ResourceReference} as a dependency. {@link ResourceReference#release()} will be called on every {@link ResourceReference} | boolean destroyDependentInstance(T instance); /** * Register a {@link ResourceReference} as a dependency. {@link ResourceReference#release()} will be called on every {@link ResourceReference} | /**
* Destroys dependent instance
* @param instance
* @return true if the instance was destroyed, false otherwise
*/ | Destroys dependent instance | destroyDependentInstance | {
"repo_name": "manovotn/core",
"path": "impl/src/main/java/org/jboss/weld/contexts/WeldCreationalContext.java",
"license": "apache-2.0",
"size": 2810
} | [
"org.jboss.weld.injection.spi.ResourceReference"
] | import org.jboss.weld.injection.spi.ResourceReference; | import org.jboss.weld.injection.spi.*; | [
"org.jboss.weld"
] | org.jboss.weld; | 1,799,917 |
public PDRange getDecodeForParameter( int paramNum )
{
PDRange retval = null;
COSArray decodeValues = getDecodeValues();
if( decodeValues != null && decodeValues.size() >= paramNum*2+1 )
{
retval = new PDRange(decodeValues, paramNum );
}
return retval;
} | PDRange function( int paramNum ) { PDRange retval = null; COSArray decodeValues = getDecodeValues(); if( decodeValues != null && decodeValues.size() >= paramNum*2+1 ) { retval = new PDRange(decodeValues, paramNum ); } return retval; } | /**
* Get the decode for the input parameter.
*
* @param paramNum The function parameter number.
*
* @return The decode parameter range or null if none is set.
*/ | Get the decode for the input parameter | getDecodeForParameter | {
"repo_name": "myrridin/qz-print",
"path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java",
"license": "lgpl-2.1",
"size": 11692
} | [
"org.apache.pdfbox.cos.COSArray",
"org.apache.pdfbox.pdmodel.common.PDRange"
] | import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.pdmodel.common.PDRange; | import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdmodel.common.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 414,218 |
private void initialize() {
frame = new JFrame();
frame.setIconImage(Toolkit
.getDefaultToolkit()
.getImage(
NPC5.class
.getResource("/images/Historias de Zagas, logo.png")));
frame.setTitle("Historias de Zagas");
frame.setBounds(100, 100, 380, 301);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setResizable(false);
frame.getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(135, 51, 221, 99);
frame.getContentPane().add(scrollPane);
JTextArea textArea = new JTextArea();
textArea.setFont(mf.MyFont(0, 13));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setEditable(false);
scrollPane.setViewportView(textArea);
JScrollPane scrollPane_1 = new JScrollPane();
scrollPane_1.setBounds(135, 153, 221, 99);
frame.getContentPane().add(scrollPane_1);
JTextArea textArea_1 = new JTextArea();
textArea_1.setWrapStyleWord(true);
textArea_1.setText("");
textArea_1.setLineWrap(true);
textArea_1.setFont(mf.MyFont(0, 13));
textArea_1.setEditable(false);
scrollPane_1.setViewportView(textArea_1);
if (JugarOnline.npc5.getMisc1().isPosesion() == true) {
ArrayList<String> pos = JugarOnline.npc5.getMisc1().getPossesion().getPos();
for (int i = 0; i < pos.size(); i++) {
if (pos.get(i) != ("-Propiedad-")) {
if(!pos.get(i).equals("null")){
textArea_1.append(pos.get(i) + "\n");
}
}
}
}
txtNombreDelObjeto = new JTextField();
txtNombreDelObjeto.setOpaque(false);
txtNombreDelObjeto.setForeground(Color.WHITE);
txtNombreDelObjeto.setText("Nombre del Objeto:");
txtNombreDelObjeto.setFont(mf.MyFont(0, 13));
txtNombreDelObjeto.setEditable(false);
txtNombreDelObjeto.setColumns(10);
txtNombreDelObjeto.setBorder(null);
txtNombreDelObjeto.setBounds(10, 20, 115, 20);
frame.getContentPane().add(txtNombreDelObjeto);
textField = new JTextField();
textField.setEditable(false);
textField.setFont(mf.MyFont(0, 11));
textField.setColumns(10);
textField.setBounds(10, 51, 115, 20);
frame.getContentPane().add(textField);
| void function() { frame = new JFrame(); frame.setIconImage(Toolkit .getDefaultToolkit() .getImage( NPC5.class .getResource(STR))); frame.setTitle(STR); frame.setBounds(100, 100, 380, 301); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setResizable(false); frame.getContentPane().setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(135, 51, 221, 99); frame.getContentPane().add(scrollPane); JTextArea textArea = new JTextArea(); textArea.setFont(mf.MyFont(0, 13)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); scrollPane.setViewportView(textArea); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(135, 153, 221, 99); frame.getContentPane().add(scrollPane_1); JTextArea textArea_1 = new JTextArea(); textArea_1.setWrapStyleWord(true); textArea_1.setText(STR-Propiedad-STRnullSTR\nSTRNombre del Objeto:"); txtNombreDelObjeto.setFont(mf.MyFont(0, 13)); txtNombreDelObjeto.setEditable(false); txtNombreDelObjeto.setColumns(10); txtNombreDelObjeto.setBorder(null); txtNombreDelObjeto.setBounds(10, 20, 115, 20); frame.getContentPane().add(txtNombreDelObjeto); textField = new JTextField(); textField.setEditable(false); textField.setFont(mf.MyFont(0, 11)); textField.setColumns(10); textField.setBounds(10, 51, 115, 20); frame.getContentPane().add(textField); | /**
* Initialize the contents of the frame.
*/ | Initialize the contents of the frame | initialize | {
"repo_name": "ZagasTales/HistoriasdeZagas",
"path": "src Graf/es/thesinsprods/zagastales/juegozagas/jugar/master/npc5/InfoMisc1Jugadores.java",
"license": "cc0-1.0",
"size": 7247
} | [
"java.awt.Toolkit",
"javax.swing.JFrame",
"javax.swing.JScrollPane",
"javax.swing.JTextArea",
"javax.swing.JTextField"
] | import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,916,172 |
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(VyberIcoActivitySD.this);
pDialog.setMessage(getString(R.string.progdata));
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
} | void function() { super.onPreExecute(); pDialog = new ProgressDialog(VyberIcoActivitySD.this); pDialog.setMessage(getString(R.string.progdata)); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } | /**
* Before starting background thread Show Progress Dialog
* */ | Before starting background thread Show Progress Dialog | onPreExecute | {
"repo_name": "eurosecom/samfantozzi",
"path": "app/src/main/java/com/eusecom/samfantozzi/VyberIcoActivitySD.java",
"license": "apache-2.0",
"size": 28138
} | [
"android.app.ProgressDialog"
] | import android.app.ProgressDialog; | import android.app.*; | [
"android.app"
] | android.app; | 12,719 |
public static StringGreaterThanCondition.Builder gt(String variable, String expectedValue) {
return StringGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue);
} | static StringGreaterThanCondition.Builder function(String variable, String expectedValue) { return StringGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue); } | /**
* Binary condition for String greater than comparison.
*
* @param variable The JSONPath expression that determines which piece of the input document is used for the comparison.
* @param expectedValue The expected value for this condition.
* @see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a>
* @see com.amazonaws.services.stepfunctions.builder.states.Choice
*/ | Binary condition for String greater than comparison | gt | {
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java",
"license": "apache-2.0",
"size": 30378
} | [
"com.amazonaws.services.stepfunctions.builder.conditions.StringGreaterThanCondition"
] | import com.amazonaws.services.stepfunctions.builder.conditions.StringGreaterThanCondition; | import com.amazonaws.services.stepfunctions.builder.conditions.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 2,038,488 |
public void linkSelectable(VRMLLinkNodeType node); | void function(VRMLLinkNodeType node); | /**
* Invoked when a link node is contact with a tracker capable of picking.
*/ | Invoked when a link node is contact with a tracker capable of picking | linkSelectable | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/vrml/renderer/common/input/LinkSelectionListener.java",
"license": "gpl-2.0",
"size": 1443
} | [
"org.web3d.vrml.nodes.VRMLLinkNodeType"
] | import org.web3d.vrml.nodes.VRMLLinkNodeType; | import org.web3d.vrml.nodes.*; | [
"org.web3d.vrml"
] | org.web3d.vrml; | 1,757,183 |
public void test(String p_XmlFile, String p_LexeltFile) throws Exception {
String line = null;
StringTokenizer tokenizer = null;
Hashtable<String, ArrayList<String>> instanceLexeltIDs = new Hashtable<String, ArrayList<String>>();
BufferedReader lexeltReader = new BufferedReader(new InputStreamReader(
new FileInputStream(p_LexeltFile)));
while ((line = lexeltReader.readLine()) != null) {
tokenizer = new StringTokenizer(line);
if (tokenizer.countTokens() < 2) {
lexeltReader.close();
}
String id = tokenizer.nextToken();
ArrayList<String> lexeltIDs = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
lexeltIDs.add(tokenizer.nextToken());
}
instanceLexeltIDs.put(id, lexeltIDs);
}
lexeltReader.close();
Reader reader = new InputStreamReader(new FileInputStream(p_XmlFile));
this.test(reader, instanceLexeltIDs);
reader.close();
}
| void function(String p_XmlFile, String p_LexeltFile) throws Exception { String line = null; StringTokenizer tokenizer = null; Hashtable<String, ArrayList<String>> instanceLexeltIDs = new Hashtable<String, ArrayList<String>>(); BufferedReader lexeltReader = new BufferedReader(new InputStreamReader( new FileInputStream(p_LexeltFile))); while ((line = lexeltReader.readLine()) != null) { tokenizer = new StringTokenizer(line); if (tokenizer.countTokens() < 2) { lexeltReader.close(); } String id = tokenizer.nextToken(); ArrayList<String> lexeltIDs = new ArrayList<String>(); while (tokenizer.hasMoreTokens()) { lexeltIDs.add(tokenizer.nextToken()); } instanceLexeltIDs.put(id, lexeltIDs); } lexeltReader.close(); Reader reader = new InputStreamReader(new FileInputStream(p_XmlFile)); this.test(reader, instanceLexeltIDs); reader.close(); } | /**
* test a xml file with given lexelt ids for each test instance
*
* @param p_XmlFile
* test file
* @param p_LexeltFile
* lexelt id of each instances
* @throws Exception
* test exception
*/ | test a xml file with given lexelt ids for each test instance | test | {
"repo_name": "canunal/dkpro-wsd-gpl",
"path": "de.tudarmstadt.ukp.dkpro.wsd.supervised.ims-gpl/src/main/java/sg/edu/nus/comp/nlp/ims/implement/WSDTest.java",
"license": "gpl-3.0",
"size": 11713
} | [
"java.io.BufferedReader",
"java.io.FileInputStream",
"java.io.InputStreamReader",
"java.io.Reader",
"java.util.ArrayList",
"java.util.Hashtable",
"java.util.StringTokenizer"
] | import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.Hashtable; import java.util.StringTokenizer; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,515,494 |
public RevCommit commitToNewRef(MetaDataUpdate update, String refName) throws IOException {
try (BatchMetaDataUpdate batch = openUpdate(update)) {
batch.write(update.getCommitBuilder());
return batch.createRef(refName);
}
} | RevCommit function(MetaDataUpdate update, String refName) throws IOException { try (BatchMetaDataUpdate batch = openUpdate(update)) { batch.write(update.getCommitBuilder()); return batch.createRef(refName); } } | /**
* Creates a new commit and a new ref based on this commit. This method mutates its receiver.
*
* @param update helper information to define the update that will occur.
* @param refName name of the ref that should be created
* @return the commit that was created
* @throws IOException if there is a storage problem and the update cannot be executed as
* requested or if it failed because of a concurrent update to the same reference
*/ | Creates a new commit and a new ref based on this commit. This method mutates its receiver | commitToNewRef | {
"repo_name": "WANdisco/gerrit",
"path": "java/com/google/gerrit/server/git/meta/VersionedMetaData.java",
"license": "apache-2.0",
"size": 20820
} | [
"java.io.IOException",
"org.eclipse.jgit.revwalk.RevCommit"
] | import java.io.IOException; import org.eclipse.jgit.revwalk.RevCommit; | import java.io.*; import org.eclipse.jgit.revwalk.*; | [
"java.io",
"org.eclipse.jgit"
] | java.io; org.eclipse.jgit; | 2,409,889 |
void rankStoryOver(Story story, Story targetStory, List<Story> allStories, Response.Listener<Story> listener,
Response.ErrorListener error); | void rankStoryOver(Story story, Story targetStory, List<Story> allStories, Response.Listener<Story> listener, Response.ErrorListener error); | /**
* Updates Story's rank higher than the given target story.
*
* @param story the story to update.
* @param targetStory the story which will remain below the given story in rank.
* @param allStories the complete list of stories, to update it's ranks.
* @param listener callback if the request was successful.
* @param error callback if the request failed.
*/ | Updates Story's rank higher than the given target story | rankStoryOver | {
"repo_name": "Monits/AgilefantAndroid",
"path": "agilefantAndroid/src/main/java/com/monits/agilefant/service/WorkItemService.java",
"license": "bsd-2-clause",
"size": 5519
} | [
"com.android.volley.Response",
"com.monits.agilefant.model.Story",
"java.util.List"
] | import com.android.volley.Response; import com.monits.agilefant.model.Story; import java.util.List; | import com.android.volley.*; import com.monits.agilefant.model.*; import java.util.*; | [
"com.android.volley",
"com.monits.agilefant",
"java.util"
] | com.android.volley; com.monits.agilefant; java.util; | 2,755,496 |
public CallTarget getCallTargetForceInit() {
getDeclaringKlass().safeInitialize();
return getCallTarget();
} | CallTarget function() { getDeclaringKlass().safeInitialize(); return getCallTarget(); } | /**
* Exposed to Interop API, to ensure that VM calls to guest classes properly initialize guest
* classes prior to the calls.
*/ | Exposed to Interop API, to ensure that VM calls to guest classes properly initialize guest classes prior to the calls | getCallTargetForceInit | {
"repo_name": "smarr/Truffle",
"path": "espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Method.java",
"license": "gpl-2.0",
"size": 64397
} | [
"com.oracle.truffle.api.CallTarget"
] | import com.oracle.truffle.api.CallTarget; | import com.oracle.truffle.api.*; | [
"com.oracle.truffle"
] | com.oracle.truffle; | 366,728 |
@Test
public void testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset()
throws Exception {
String actual = md5Digester.digestFileAs32ByteHex(testFile, null, false, null);
assertThat(actual, is(isWindows ? expectedTestFileMd5Win : expectedTestFileMd5));
} | void function() throws Exception { String actual = md5Digester.digestFileAs32ByteHex(testFile, null, false, null); assertThat(actual, is(isWindows ? expectedTestFileMd5Win : expectedTestFileMd5)); } | /**
* Method: digestFileAs32ByteHex(File file, Charset charset, boolean
* doesNeedConvertLineEndings, ClientLineEnding clientLineEnding)
*/ | Method: digestFileAs32ByteHex(File file, Charset charset, boolean doesNeedConvertLineEndings, ClientLineEnding clientLineEnding) | testDigestFileAs32ByteHexForFileCharsetConvertLineEndingsClientLineEndingNonCharset | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/r18-1/src/test/java/com/perforce/p4java/impl/mapbased/rpc/func/helper/MD5DigesterTest.java",
"license": "apache-2.0",
"size": 26526
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 1,430,733 |
public ServiceFuture<Void> startAsync(String resourceGroupName, String applicationGatewayName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, applicationGatewayName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String applicationGatewayName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, applicationGatewayName), serviceCallback); } | /**
* Starts the specified application gateway.
*
* @param resourceGroupName The name of the resource group.
* @param applicationGatewayName The name of the application gateway.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Starts the specified application gateway | startAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/ApplicationGatewaysInner.java",
"license": "mit",
"size": 174118
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,067,572 |
@Test
public void testGetByteArray() {
byte [] byteArray = null;
byteArray = abstractInput.getByteArray();
String byteString = new String(byteArray);
assertTrue("ByteArray is null", byteArray != null);
}
| void function() { byte [] byteArray = null; byteArray = abstractInput.getByteArray(); String byteString = new String(byteArray); assertTrue(STR, byteArray != null); } | /**
* Test method for {@link org.jhove2.core.io.AbstractInput#getByteArray()}.
*/ | Test method for <code>org.jhove2.core.io.AbstractInput#getByteArray()</code> | testGetByteArray | {
"repo_name": "opf-labs/jhove2",
"path": "src/test/java/org/jhove2/core/io/MappedInputTest.java",
"license": "bsd-2-clause",
"size": 14509
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,064,204 |
@Override
protected final boolean readNextRecord() throws IOException {
if (!readerDelegate.readNextRecord()) {
return false;
}
synchronized (progressLock) {
++numRecordsRead;
}
return true;
} | final boolean function() throws IOException { if (!readerDelegate.readNextRecord()) { return false; } synchronized (progressLock) { ++numRecordsRead; } return true; } | /**
* Reads the next record via the delegate reader.
*/ | Reads the next record via the delegate reader | readNextRecord | {
"repo_name": "amitsela/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/CompressedSource.java",
"license": "apache-2.0",
"size": 21672
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,612,680 |
public Frame getCurrent(); | Frame function(); | /**
* Gets the current frame of the animated hologram
*
* @return the current frame of the animated hologram
*/ | Gets the current frame of the animated hologram | getCurrent | {
"repo_name": "khmMinecraftProjects/HoloAPI",
"path": "src/main/java/com/dsh105/holoapi/api/AnimatedHologram.java",
"license": "gpl-3.0",
"size": 3399
} | [
"com.dsh105.holoapi.image.Frame"
] | import com.dsh105.holoapi.image.Frame; | import com.dsh105.holoapi.image.*; | [
"com.dsh105.holoapi"
] | com.dsh105.holoapi; | 2,442,593 |
Set<String> schemaFields = Sets.newHashSet(fields);
// ensure that fields introduced by breakdowns added to schema
if (breakdowns != null) {
breakdowns.getActionBreakdowns().forEach(
breakdownValue -> {
if (breakdownsWithFields.contains(breakdownValue.toString())) {
schemaFields.add(breakdownValue.toString());
}
}
);
breakdowns.getBreakdowns().forEach(
breakdownValue -> {
if (breakdownsWithFields.contains(breakdownValue.toString())) {
schemaFields.add(breakdownValue.toString());
}
}
);
}
return Schema.recordOf(
"FacebookAdsInsights",
schemaFields.stream().map(SchemaHelper::fromName).collect(Collectors.toList()));
}
private static final Map<String, String> API_FIELD_NAME_TO_SCHEMA_NAME = ImmutableMap.<String, String>builder()
.put("1d_click", "click_1d")
.put("1d_view", "view_1d")
.put("28d_click", "click_28d")
.put("28d_view", "view_28d")
.put("7d_click", "click_7d")
.put("7d_view", "view_7d")
.build(); | Set<String> schemaFields = Sets.newHashSet(fields); if (breakdowns != null) { breakdowns.getActionBreakdowns().forEach( breakdownValue -> { if (breakdownsWithFields.contains(breakdownValue.toString())) { schemaFields.add(breakdownValue.toString()); } } ); breakdowns.getBreakdowns().forEach( breakdownValue -> { if (breakdownsWithFields.contains(breakdownValue.toString())) { schemaFields.add(breakdownValue.toString()); } } ); } return Schema.recordOf( STR, schemaFields.stream().map(SchemaHelper::fromName).collect(Collectors.toList())); } private static final Map<String, String> API_FIELD_NAME_TO_SCHEMA_NAME = ImmutableMap.<String, String>builder() .put(STR, STR) .put(STR, STR) .put(STR, STR) .put(STR, STR) .put(STR, STR) .put(STR, STR) .build(); | /**
* Returns selected Schema.
* @param fields The fields
* @param breakdowns The breakdowns
* @return The instance of Schema
*/ | Returns selected Schema | buildSchema | {
"repo_name": "data-integrations/facebook",
"path": "src/main/java/io/cdap/plugin/facebook/source/common/SchemaHelper.java",
"license": "apache-2.0",
"size": 16990
} | [
"com.google.common.collect.ImmutableMap",
"com.google.common.collect.Sets",
"io.cdap.cdap.api.data.schema.Schema",
"java.util.Map",
"java.util.Set",
"java.util.stream.Collectors"
] | import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; import io.cdap.cdap.api.data.schema.Schema; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; | import com.google.common.collect.*; import io.cdap.cdap.api.data.schema.*; import java.util.*; import java.util.stream.*; | [
"com.google.common",
"io.cdap.cdap",
"java.util"
] | com.google.common; io.cdap.cdap; java.util; | 1,595,822 |
protected void sendData(OutputStream out) throws IOException {
if (this.dataLength() > 0) {
out.write(this.getData());
//System.err.println(new String(this.getData(),"UTF-8"));
}
} | void function(OutputStream out) throws IOException { if (this.dataLength() > 0) { out.write(this.getData()); } } | /**
* Write the part data to the stream.
* @param out the output stream
* @throws IOException if an exception occurs
*/ | Write the part data to the stream | sendData | {
"repo_name": "GeoinformationSystems/GeoprocessingAppstore",
"path": "src/com/esri/gpt/agp/multipart2/MPart.java",
"license": "apache-2.0",
"size": 11018
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,841,373 |
void addLang(String locale){
String localeString = JMeterUtils.getLocaleString(locale);
JMenuItem language = new JMenuItem(localeString);
language.addActionListener(actionRouter);
language.setActionCommand(ActionNames.CHANGE_LANGUAGE);
language.setName(locale); // This is used by the ChangeLanguage class to define the Locale
languageMenu.add(language);
}
} | void addLang(String locale){ String localeString = JMeterUtils.getLocaleString(locale); JMenuItem language = new JMenuItem(localeString); language.addActionListener(actionRouter); language.setActionCommand(ActionNames.CHANGE_LANGUAGE); language.setName(locale); languageMenu.add(language); } } | /**
* Create a language entry from the locale name.
*
* @param locale - must also be a valid resource name
*/ | Create a language entry from the locale name | addLang | {
"repo_name": "ubikfsabbe/jmeter",
"path": "src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java",
"license": "apache-2.0",
"size": 31344
} | [
"javax.swing.JMenuItem",
"org.apache.jmeter.gui.action.ActionNames",
"org.apache.jmeter.util.JMeterUtils"
] | import javax.swing.JMenuItem; import org.apache.jmeter.gui.action.ActionNames; import org.apache.jmeter.util.JMeterUtils; | import javax.swing.*; import org.apache.jmeter.gui.action.*; import org.apache.jmeter.util.*; | [
"javax.swing",
"org.apache.jmeter"
] | javax.swing; org.apache.jmeter; | 961,066 |
String flavor = request.getParameter("flavor");
if (flavor != null && flavor.equalsIgnoreCase("tab")) {
Log log = getLog(request, response);
getModel().put("log", log);
return new LogAsTabDelimitedView();
} else {
String log = getLogFile(request, response);
getModel().put("text", log);
return new PlainTextView();
}
} | String flavor = request.getParameter(STR); if (flavor != null && flavor.equalsIgnoreCase("tab")) { Log log = getLog(request, response); getModel().put("log", log); return new LogAsTabDelimitedView(); } else { String log = getLogFile(request, response); getModel().put("text", log); return new PlainTextView(); } } | /**
* Peforms the processing associated with this action.
*
* @param request the HttpServletRequest instance
* @param response the HttpServletResponse instance
* @return the name of the next view
*/ | Peforms the processing associated with this action | process | {
"repo_name": "arshadalisoomro/pebble",
"path": "src/main/java/net/sourceforge/pebble/web/action/ViewLogAction.java",
"license": "bsd-3-clause",
"size": 2818
} | [
"net.sourceforge.pebble.logging.Log",
"net.sourceforge.pebble.web.view.PlainTextView",
"net.sourceforge.pebble.web.view.impl.LogAsTabDelimitedView"
] | import net.sourceforge.pebble.logging.Log; import net.sourceforge.pebble.web.view.PlainTextView; import net.sourceforge.pebble.web.view.impl.LogAsTabDelimitedView; | import net.sourceforge.pebble.logging.*; import net.sourceforge.pebble.web.view.*; import net.sourceforge.pebble.web.view.impl.*; | [
"net.sourceforge.pebble"
] | net.sourceforge.pebble; | 2,246,653 |
public ObjectStore getObjectStore() {
return resultsBatches.getObjectStore();
} | ObjectStore function() { return resultsBatches.getObjectStore(); } | /**
* Returns the ObjectStore that this Results object will use
*
* @return an ObjectStore
*/ | Returns the ObjectStore that this Results object will use | getObjectStore | {
"repo_name": "elsiklab/intermine",
"path": "intermine/objectstore/main/src/org/intermine/objectstore/query/Results.java",
"license": "lgpl-2.1",
"size": 14105
} | [
"org.intermine.objectstore.ObjectStore"
] | import org.intermine.objectstore.ObjectStore; | import org.intermine.objectstore.*; | [
"org.intermine.objectstore"
] | org.intermine.objectstore; | 2,317,644 |
@Override // FsDatasetSpi
public long getLength(ExtendedBlock b) throws IOException {
memManager.get(b.getBlockPoolId(), b.getBlockId());
MemDatasetManager.MemBlockMeta meta = memManager.get(b.getBlockPoolId(), b.getBlockId());
if (meta != null) return meta.getNumBytes();
return -1;
} | @Override long function(ExtendedBlock b) throws IOException { memManager.get(b.getBlockPoolId(), b.getBlockId()); MemDatasetManager.MemBlockMeta meta = memManager.get(b.getBlockPoolId(), b.getBlockId()); if (meta != null) return meta.getNumBytes(); return -1; } | /**
* Find the block's on-disk length
*/ | Find the block's on-disk length | getLength | {
"repo_name": "songweijia/fffs",
"path": "sources/hadoop-2.4.1-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/MemDatasetImpl.java",
"license": "apache-2.0",
"size": 40841
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.ExtendedBlock"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 951,653 |
public List<String> getDeclarationIds(); | List<String> function(); | /**
* Returns the list of declaration identifiers that are bound to the
* tuple that created this Match.
*
* @return
*/ | Returns the list of declaration identifiers that are bound to the tuple that created this Match | getDeclarationIds | {
"repo_name": "psiroky/droolsjbpm-knowledge",
"path": "kie-api/src/main/java/org/kie/runtime/rule/Match.java",
"license": "apache-2.0",
"size": 1462
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,471,320 |
@Override
public Token<DelegationTokenIdentifier>
getDelegationToken(Text renewer
)throws IOException, InterruptedException {
if (!isAllowedDelegationTokenOp()) {
throw new IOException(
"Delegation Token can be issued only with kerberos authentication");
}
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
Text owner = new Text(ugi.getUserName());
Text realUser = null;
if (ugi.getRealUser() != null) {
realUser = new Text(ugi.getRealUser().getUserName());
}
DelegationTokenIdentifier ident =
new DelegationTokenIdentifier(owner, renewer, realUser);
return new Token<DelegationTokenIdentifier>(ident, secretManager);
} | Token<DelegationTokenIdentifier> function(Text renewer )throws IOException, InterruptedException { if (!isAllowedDelegationTokenOp()) { throw new IOException( STR); } UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); Text owner = new Text(ugi.getUserName()); Text realUser = null; if (ugi.getRealUser() != null) { realUser = new Text(ugi.getRealUser().getUserName()); } DelegationTokenIdentifier ident = new DelegationTokenIdentifier(owner, renewer, realUser); return new Token<DelegationTokenIdentifier>(ident, secretManager); } | /**
* Get a new delegation token.
*/ | Get a new delegation token | getDelegationToken | {
"repo_name": "williamsentosa/hadoop-modified",
"path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java",
"license": "apache-2.0",
"size": 192030
} | [
"java.io.IOException",
"org.apache.hadoop.io.Text",
"org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.security.token.Token"
] | import java.io.IOException; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; | import java.io.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.security.token.delegation.*; import org.apache.hadoop.security.*; import org.apache.hadoop.security.token.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 10,021 |
public static Object invokeExactMethod(final Object object, final String methodName) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
return invokeExactMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null);
} | static Object function(final Object object, final String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return invokeExactMethod(object, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, null); } | /**
* <p>Invokes a method whose parameter types match exactly the object
* types.</p>
*
* <p>This uses reflection to invoke the method obtained from a call to
* {@link #getAccessibleMethod}(Class, String, Class[])}.</p>
*
* @param object invoke method on this object
* @param methodName get method with this name
* @return The value returned by the invoked method
*
* @throws NoSuchMethodException if there is no such accessible method
* @throws InvocationTargetException wraps an exception thrown by the
* method invoked
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*
* @since 3.4
*/ | Invokes a method whose parameter types match exactly the object types. This uses reflection to invoke the method obtained from a call to <code>#getAccessibleMethod</code>(Class, String, Class[])} | invokeExactMethod | {
"repo_name": "apache/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java",
"license": "apache-2.0",
"size": 46974
} | [
"java.lang.reflect.InvocationTargetException",
"org.apache.commons.lang3.ArrayUtils"
] | import java.lang.reflect.InvocationTargetException; import org.apache.commons.lang3.ArrayUtils; | import java.lang.reflect.*; import org.apache.commons.lang3.*; | [
"java.lang",
"org.apache.commons"
] | java.lang; org.apache.commons; | 2,367,575 |
public File getBaseDir()
{
return baseDir;
} | File function() { return baseDir; } | /**
* Returns the directory to locate source files relative to.
*
* @return the base directory
*/ | Returns the directory to locate source files relative to | getBaseDir | {
"repo_name": "izpack/izpack",
"path": "izpack-test/src/test/java/com/izforge/izpack/compiler/container/TestCompilationContainer.java",
"license": "apache-2.0",
"size": 5593
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 517,556 |
public void setRect(RectF r) {
mRectangle[0].mPosX = r.left;
mRectangle[0].mPosY = r.top;
mRectangle[1].mPosX = r.left;
mRectangle[1].mPosY = r.bottom;
mRectangle[2].mPosX = r.right;
mRectangle[2].mPosY = r.top;
mRectangle[3].mPosX = r.right;
mRectangle[3].mPosY = r.bottom;
} | void function(RectF r) { mRectangle[0].mPosX = r.left; mRectangle[0].mPosY = r.top; mRectangle[1].mPosX = r.left; mRectangle[1].mPosY = r.bottom; mRectangle[2].mPosX = r.right; mRectangle[2].mPosY = r.top; mRectangle[3].mPosX = r.right; mRectangle[3].mPosY = r.bottom; } | /**
* Update mesh bounds.
*/ | Update mesh bounds | setRect | {
"repo_name": "mingming-killer/K7UI",
"path": "K7UI/src/com/eebbk/mingming/k7ui/effector/CurlMesh.java",
"license": "apache-2.0",
"size": 33625
} | [
"android.graphics.RectF"
] | import android.graphics.RectF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,383,792 |
public GfxColor getLinkClassForegroundColor() {
return linkClassForegroundColor;
} | GfxColor function() { return linkClassForegroundColor; } | /**
* Getter for the linkClassForegroundColor
*
* @return the linkClassForegroundColor
*/ | Getter for the linkClassForegroundColor | getLinkClassForegroundColor | {
"repo_name": "RaphaelBrugier/gwtuml",
"path": "GWTUMLAPI/src/com/objetdirect/gwt/umlapi/client/helpers/ThemeManager.java",
"license": "gpl-3.0",
"size": 23588
} | [
"com.objetdirect.gwt.umlapi.client.gfx.GfxColor"
] | import com.objetdirect.gwt.umlapi.client.gfx.GfxColor; | import com.objetdirect.gwt.umlapi.client.gfx.*; | [
"com.objetdirect.gwt"
] | com.objetdirect.gwt; | 1,477,213 |
final public Bundle getArguments() {
return mArguments;
} | final Bundle function() { return mArguments; } | /**
* Return the arguments supplied when the fragment was instantiated,
* if any.
*/ | Return the arguments supplied when the fragment was instantiated, if any | getArguments | {
"repo_name": "rytina/dukecon_appsgenerator",
"path": "org.applause.lang.generator.android/sdk/extras/android/support/v4/src/java/android/support/v4/app/Fragment.java",
"license": "epl-1.0",
"size": 85868
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 2,298,340 |
private void updateDetailData() {
if (LOGD) Log.d(TAG, "updateDetailData()");
final long start = mChart.getInspectStart();
final long end = mChart.getInspectEnd();
final long now = System.currentTimeMillis();
final Context context = getActivity();
NetworkStatsHistory.Entry entry = null;
if (isAppDetailMode() && mChartData != null && mChartData.detail != null) {
// bind foreground/background to piechart and labels
entry = mChartData.detailDefault.getValues(start, end, now, entry);
final long defaultBytes = entry.rxBytes + entry.txBytes;
entry = mChartData.detailForeground.getValues(start, end, now, entry);
final long foregroundBytes = entry.rxBytes + entry.txBytes;
final long totalBytes = defaultBytes + foregroundBytes;
if (mAppTotal != null) {
mAppTotal.setText(Formatter.formatFileSize(context, totalBytes));
}
mAppBackground.setText(Formatter.formatFileSize(context, defaultBytes));
mAppForeground.setText(Formatter.formatFileSize(context, foregroundBytes));
// and finally leave with summary data for label below
entry = mChartData.detail.getValues(start, end, now, null);
getLoaderManager().destroyLoader(LOADER_SUMMARY);
mCycleSummary.setVisibility(View.GONE);
} else {
if (mChartData != null) {
entry = mChartData.network.getValues(start, end, now, null);
}
mCycleSummary.setVisibility(View.VISIBLE);
// kick off loader for detailed stats
getLoaderManager().restartLoader(LOADER_SUMMARY,
SummaryForAllUidLoader.buildArgs(mTemplate, start, end), mSummaryCallbacks);
}
final long totalBytes = entry != null ? entry.rxBytes + entry.txBytes : 0;
final String totalPhrase = Formatter.formatFileSize(context, totalBytes);
mCycleSummary.setText(totalPhrase);
if (isMobileTab(mCurrentTab) || TAB_3G.equals(mCurrentTab)
|| TAB_4G.equals(mCurrentTab)) {
if (isAppDetailMode()) {
mDisclaimer.setVisibility(View.GONE);
} else {
mDisclaimer.setVisibility(View.VISIBLE);
}
} else {
mDisclaimer.setVisibility(View.GONE);
}
// initial layout is finished above, ensure we have transitions
ensureLayoutTransitions();
} | void function() { if (LOGD) Log.d(TAG, STR); final long start = mChart.getInspectStart(); final long end = mChart.getInspectEnd(); final long now = System.currentTimeMillis(); final Context context = getActivity(); NetworkStatsHistory.Entry entry = null; if (isAppDetailMode() && mChartData != null && mChartData.detail != null) { entry = mChartData.detailDefault.getValues(start, end, now, entry); final long defaultBytes = entry.rxBytes + entry.txBytes; entry = mChartData.detailForeground.getValues(start, end, now, entry); final long foregroundBytes = entry.rxBytes + entry.txBytes; final long totalBytes = defaultBytes + foregroundBytes; if (mAppTotal != null) { mAppTotal.setText(Formatter.formatFileSize(context, totalBytes)); } mAppBackground.setText(Formatter.formatFileSize(context, defaultBytes)); mAppForeground.setText(Formatter.formatFileSize(context, foregroundBytes)); entry = mChartData.detail.getValues(start, end, now, null); getLoaderManager().destroyLoader(LOADER_SUMMARY); mCycleSummary.setVisibility(View.GONE); } else { if (mChartData != null) { entry = mChartData.network.getValues(start, end, now, null); } mCycleSummary.setVisibility(View.VISIBLE); getLoaderManager().restartLoader(LOADER_SUMMARY, SummaryForAllUidLoader.buildArgs(mTemplate, start, end), mSummaryCallbacks); } final long totalBytes = entry != null ? entry.rxBytes + entry.txBytes : 0; final String totalPhrase = Formatter.formatFileSize(context, totalBytes); mCycleSummary.setText(totalPhrase); if (isMobileTab(mCurrentTab) TAB_3G.equals(mCurrentTab) TAB_4G.equals(mCurrentTab)) { if (isAppDetailMode()) { mDisclaimer.setVisibility(View.GONE); } else { mDisclaimer.setVisibility(View.VISIBLE); } } else { mDisclaimer.setVisibility(View.GONE); } ensureLayoutTransitions(); } | /**
* Update details based on {@link #mChart} inspection range depending on
* current mode. In network mode, updates {@link #mAdapter} with sorted list
* of applications data usage, and when {@link #isAppDetailMode()} update
* app details.
*/ | Update details based on <code>#mChart</code> inspection range depending on current mode. In network mode, updates <code>#mAdapter</code> with sorted list of applications data usage, and when <code>#isAppDetailMode()</code> update app details | updateDetailData | {
"repo_name": "Ant-Droid/android_packages_apps_Settings_OLD",
"path": "src/com/android/settings/DataUsageSummary.java",
"license": "apache-2.0",
"size": 111764
} | [
"android.content.Context",
"android.net.NetworkStatsHistory",
"android.text.format.Formatter",
"android.util.Log",
"android.view.View",
"com.android.settings.net.SummaryForAllUidLoader"
] | import android.content.Context; import android.net.NetworkStatsHistory; import android.text.format.Formatter; import android.util.Log; import android.view.View; import com.android.settings.net.SummaryForAllUidLoader; | import android.content.*; import android.net.*; import android.text.format.*; import android.util.*; import android.view.*; import com.android.settings.net.*; | [
"android.content",
"android.net",
"android.text",
"android.util",
"android.view",
"com.android.settings"
] | android.content; android.net; android.text; android.util; android.view; com.android.settings; | 1,045,356 |
public static ImageRaster create(Image image) {
if (image.getData().size() > 1) {
throw new IllegalStateException("Use constructor that takes slices argument to read from multislice image");
}
return create(image, 0, 0, false);
}
public ImageRaster() {
} | static ImageRaster function(Image image) { if (image.getData().size() > 1) { throw new IllegalStateException(STR); } return create(image, 0, 0, false); } public ImageRaster() { } | /**
* Create new image reader / writer for 2D images.
*
* @param image The image to read / write to.
* @return An ImageRaster to read / write to the image.
*/ | Create new image reader / writer for 2D images | create | {
"repo_name": "PlanetWaves/clockworkengine",
"path": "trunk/jme3-core/src/main/java/com/jme3/texture/image/ImageRaster.java",
"license": "apache-2.0",
"size": 8769
} | [
"com.jme3.texture.Image"
] | import com.jme3.texture.Image; | import com.jme3.texture.*; | [
"com.jme3.texture"
] | com.jme3.texture; | 2,666,816 |
public boolean shouldInterceptTouchEvent(MotionEvent ev) {
final int action = MotionEventCompat.getActionMasked(ev);
final int actionIndex = MotionEventCompat.getActionIndex(ev);
if (action == MotionEvent.ACTION_DOWN) {
// Reset things for a new event stream, just in case we didn't get
// the whole previous stream.
cancel();
}
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(ev);
switch (action) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
final float y = ev.getY();
final int pointerId = MotionEventCompat.getPointerId(ev, 0);
saveInitialMotion(x, y, pointerId);
final View toCapture = findTopChildUnder((int) x, (int) y);
// Catch a settling view if possible.
if (toCapture == mCapturedView && mDragState == STATE_SETTLING) {
tryCaptureViewForDrag(toCapture, pointerId);
}
final int edgesTouched = mInitialEdgesTouched[pointerId];
if ((edgesTouched & mTrackingEdges) != 0) {
mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
}
break;
}
case MotionEventCompat.ACTION_POINTER_DOWN: {
final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex);
final float x = MotionEventCompat.getX(ev, actionIndex);
final float y = MotionEventCompat.getY(ev, actionIndex);
saveInitialMotion(x, y, pointerId);
// A ViewDragHelper can only manipulate one view at a time.
if (mDragState == STATE_IDLE) {
final int edgesTouched = mInitialEdgesTouched[pointerId];
if ((edgesTouched & mTrackingEdges) != 0) {
mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
}
} else if (mDragState == STATE_SETTLING) {
// Catch a settling view if possible.
final View toCapture = findTopChildUnder((int) x, (int) y);
if (toCapture == mCapturedView) {
tryCaptureViewForDrag(toCapture, pointerId);
}
}
break;
}
case MotionEvent.ACTION_MOVE: {
// First to cross a touch slop over a draggable view wins. Also report edge drags.
final int pointerCount = MotionEventCompat.getPointerCount(ev);
for (int i = 0; i < pointerCount; i++) {
final int pointerId = MotionEventCompat.getPointerId(ev, i);
final float x = MotionEventCompat.getX(ev, i);
final float y = MotionEventCompat.getY(ev, i);
final float dx = x - mInitialMotionX[pointerId];
final float dy = y - mInitialMotionY[pointerId];
final View toCapture = findTopChildUnder((int) x, (int) y);
final boolean pastSlop = toCapture != null && checkTouchSlop(toCapture, dx, dy);
if (pastSlop) {
// check the callback's
// getView[Horizontal|Vertical]DragRange methods to know
// if you can move at all along an axis, then see if it
// would clamp to the same value. If you can't move at
// all in every dimension with a nonzero range, bail.
final int oldLeft = toCapture.getLeft();
final int targetLeft = oldLeft + (int) dx;
final int newLeft = mCallback.clampViewPositionHorizontal(toCapture,
targetLeft, (int) dx);
final int oldTop = toCapture.getTop();
final int targetTop = oldTop + (int) dy;
final int newTop = mCallback.clampViewPositionVertical(toCapture, targetTop,
(int) dy);
final int horizontalDragRange = mCallback.getViewHorizontalDragRange(
toCapture);
final int verticalDragRange = mCallback.getViewVerticalDragRange(toCapture);
if ((horizontalDragRange == 0 || horizontalDragRange > 0
&& newLeft == oldLeft) && (verticalDragRange == 0
|| verticalDragRange > 0 && newTop == oldTop)) {
break;
}
}
reportNewEdgeDrags(dx, dy, pointerId);
if (mDragState == STATE_DRAGGING) {
// Callback might have started an edge drag
break;
}
if (pastSlop && tryCaptureViewForDrag(toCapture, pointerId)) {
break;
}
}
saveLastMotion(ev);
break;
}
case MotionEventCompat.ACTION_POINTER_UP: {
final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex);
clearMotionHistory(pointerId);
break;
}
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: {
cancel();
break;
}
}
return mDragState == STATE_DRAGGING;
} | boolean function(MotionEvent ev) { final int action = MotionEventCompat.getActionMasked(ev); final int actionIndex = MotionEventCompat.getActionIndex(ev); if (action == MotionEvent.ACTION_DOWN) { cancel(); } if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(ev); switch (action) { case MotionEvent.ACTION_DOWN: { final float x = ev.getX(); final float y = ev.getY(); final int pointerId = MotionEventCompat.getPointerId(ev, 0); saveInitialMotion(x, y, pointerId); final View toCapture = findTopChildUnder((int) x, (int) y); if (toCapture == mCapturedView && mDragState == STATE_SETTLING) { tryCaptureViewForDrag(toCapture, pointerId); } final int edgesTouched = mInitialEdgesTouched[pointerId]; if ((edgesTouched & mTrackingEdges) != 0) { mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId); } break; } case MotionEventCompat.ACTION_POINTER_DOWN: { final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex); final float x = MotionEventCompat.getX(ev, actionIndex); final float y = MotionEventCompat.getY(ev, actionIndex); saveInitialMotion(x, y, pointerId); if (mDragState == STATE_IDLE) { final int edgesTouched = mInitialEdgesTouched[pointerId]; if ((edgesTouched & mTrackingEdges) != 0) { mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId); } } else if (mDragState == STATE_SETTLING) { final View toCapture = findTopChildUnder((int) x, (int) y); if (toCapture == mCapturedView) { tryCaptureViewForDrag(toCapture, pointerId); } } break; } case MotionEvent.ACTION_MOVE: { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); final float dx = x - mInitialMotionX[pointerId]; final float dy = y - mInitialMotionY[pointerId]; final View toCapture = findTopChildUnder((int) x, (int) y); final boolean pastSlop = toCapture != null && checkTouchSlop(toCapture, dx, dy); if (pastSlop) { final int oldLeft = toCapture.getLeft(); final int targetLeft = oldLeft + (int) dx; final int newLeft = mCallback.clampViewPositionHorizontal(toCapture, targetLeft, (int) dx); final int oldTop = toCapture.getTop(); final int targetTop = oldTop + (int) dy; final int newTop = mCallback.clampViewPositionVertical(toCapture, targetTop, (int) dy); final int horizontalDragRange = mCallback.getViewHorizontalDragRange( toCapture); final int verticalDragRange = mCallback.getViewVerticalDragRange(toCapture); if ((horizontalDragRange == 0 horizontalDragRange > 0 && newLeft == oldLeft) && (verticalDragRange == 0 verticalDragRange > 0 && newTop == oldTop)) { break; } } reportNewEdgeDrags(dx, dy, pointerId); if (mDragState == STATE_DRAGGING) { break; } if (pastSlop && tryCaptureViewForDrag(toCapture, pointerId)) { break; } } saveLastMotion(ev); break; } case MotionEventCompat.ACTION_POINTER_UP: { final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex); clearMotionHistory(pointerId); break; } case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: { cancel(); break; } } return mDragState == STATE_DRAGGING; } | /**
* Check if this event as provided to the parent view's onInterceptTouchEvent should
* cause the parent to intercept the touch event stream.
*
* @param ev MotionEvent provided to onInterceptTouchEvent
* @return true if the parent view should return true from onInterceptTouchEvent
*/ | Check if this event as provided to the parent view's onInterceptTouchEvent should cause the parent to intercept the touch event stream | shouldInterceptTouchEvent | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/support/v4/java/android/support/v4/widget/ViewDragHelper.java",
"license": "gpl-3.0",
"size": 61407
} | [
"android.support.v4.view.MotionEventCompat",
"android.view.MotionEvent",
"android.view.VelocityTracker",
"android.view.View"
] | import android.support.v4.view.MotionEventCompat; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; | import android.support.v4.view.*; import android.view.*; | [
"android.support",
"android.view"
] | android.support; android.view; | 2,518,792 |
@NotAuditable
EditionService getEditionService();
| EditionService getEditionService(); | /**
* Get the Edition Service
*/ | Get the Edition Service | getEditionService | {
"repo_name": "thumx/community-edition",
"path": "projects/repository/source/java/org/alfresco/service/ServiceRegistry.java",
"license": "lgpl-3.0",
"size": 20716
} | [
"org.alfresco.service.cmr.ml.EditionService"
] | import org.alfresco.service.cmr.ml.EditionService; | import org.alfresco.service.cmr.ml.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 548,197 |
void generateCase(int key, Label end); | void generateCase(int key, Label end); | /**
* Generates the code for a switch case.
*
* @param key the switch case key.
* @param end a label that corresponds to the end of the switch statement.
*/ | Generates the code for a switch case | generateCase | {
"repo_name": "syntelos/gwtcc",
"path": "src/com/google/gwt/dev/asm/commons/TableSwitchGenerator.java",
"license": "apache-2.0",
"size": 2245
} | [
"com.google.gwt.dev.asm.Label"
] | import com.google.gwt.dev.asm.Label; | import com.google.gwt.dev.asm.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,205,914 |
public static boolean getAutoCommit(Connection conn) {
return false;
} | static boolean function(Connection conn) { return false; } | /**
* Retrieves the autocommit status of this connection. <p>
*
* @param conn the <code>Connection</code> object for which to retrieve
* the current autocommit status
* @return a boolean value representing the connection's autocommit status
* @since 1.7.0
*/ | Retrieves the autocommit status of this connection. | getAutoCommit | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/hsqldb/src/org/hsqldb/Library.java",
"license": "gpl-3.0",
"size": 79683
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 579,865 |
public void setInputStream(InputStream stream) {
inputStream = stream;
} | void function(InputStream stream) { inputStream = stream; } | /**
* Set the input stream.
* @param stream
*/ | Set the input stream | setInputStream | {
"repo_name": "andrejb/DspBenchmarking",
"path": "src/br/usp/ime/dspbenchmarking/threads/DspThread.java",
"license": "gpl-3.0",
"size": 17610
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,771,706 |
// needs to be protected because enum members are actually subclasses
protected String getSwitchStateMessage(OFChannelHandler h,
OFMessage m,
String details) {
return String.format("Switch: [%s], State: [%s], received: [%s]"
+ ", details: %s",
h.getSwitchInfoString(),
this.toString(),
m.getType().toString(),
details);
} | String function(OFChannelHandler h, OFMessage m, String details) { return String.format(STR + STR, h.getSwitchInfoString(), this.toString(), m.getType().toString(), details); } | /**
* Get a string specifying the switch connection, state, and
* message received. To be used as message for SwitchStateException
* or log messages
* @param h The channel handler (to get switch information_
* @param m The OFMessage that has just been received
* @param details A string giving more details about the exact nature
* of the problem.
* @return display string
*/ | Get a string specifying the switch connection, state, and message received. To be used as message for SwitchStateException or log messages | getSwitchStateMessage | {
"repo_name": "sonu283304/onos",
"path": "protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java",
"license": "apache-2.0",
"size": 54129
} | [
"org.projectfloodlight.openflow.protocol.OFMessage"
] | import org.projectfloodlight.openflow.protocol.OFMessage; | import org.projectfloodlight.openflow.protocol.*; | [
"org.projectfloodlight.openflow"
] | org.projectfloodlight.openflow; | 869,315 |
public void addPlayer(Player p) {
m_players.add(p);
}
| void function(Player p) { m_players.add(p); } | /**
* Adds a player to the list of players
* @param p
*/ | Adds a player to the list of players | addPlayer | {
"repo_name": "Nushio/ArenaClient",
"path": "src/net/k3rnel/arena/client/backend/ClientMapMatrix.java",
"license": "gpl-3.0",
"size": 10600
} | [
"net.k3rnel.arena.client.backend.entity.Player"
] | import net.k3rnel.arena.client.backend.entity.Player; | import net.k3rnel.arena.client.backend.entity.*; | [
"net.k3rnel.arena"
] | net.k3rnel.arena; | 1,808,256 |
@Override
public final Validation getCachedMoveValidation(Move<?> move) {
if(validatedMove == null || !validatedMove.equals(move)){
// cache miss
return null;
} else {
// cache hit
return validation;
}
} | final Validation function(Move<?> move) { if(validatedMove == null !validatedMove.equals(move)){ return null; } else { return validation; } } | /**
* Retrieve a cached validation, if still available. If the validation of any other move has
* been cached at a later point in time, the value for this move will have been overwritten.
*
* @param move move applied to the current solution
* @return cached validation of the obtained neighbour, if available, <code>null</code> if not
*/ | Retrieve a cached validation, if still available. If the validation of any other move has been cached at a later point in time, the value for this move will have been overwritten | getCachedMoveValidation | {
"repo_name": "hdbeukel/james-core",
"path": "src/main/java/org/jamesframework/core/search/cache/SingleEvaluatedMoveCache.java",
"license": "apache-2.0",
"size": 4335
} | [
"org.jamesframework.core.problems.constraints.validations.Validation",
"org.jamesframework.core.search.neigh.Move"
] | import org.jamesframework.core.problems.constraints.validations.Validation; import org.jamesframework.core.search.neigh.Move; | import org.jamesframework.core.problems.constraints.validations.*; import org.jamesframework.core.search.neigh.*; | [
"org.jamesframework.core"
] | org.jamesframework.core; | 293,833 |
@Test
public void testOlderClientOperations() throws Exception {
// Use old HTable to test
TransactionAwareHTable oldTxAware = new OldTransactionAwareHTable(hTable);
transactionContext.addTransactionAware(oldTxAware);
transactionContext.start();
Put put = new Put(TestBytes.row);
put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value);
oldTxAware.put(put);
transactionContext.finish();
transactionContext.start();
long txId = transactionContext.getCurrentTransaction().getTransactionId();
put = new Put(TestBytes.row);
put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value2);
oldTxAware.put(put);
// Invalidate the second Put
TransactionSystemClient txClient = new InMemoryTxSystemClient(txManager);
txClient.invalidate(txId);
transactionContext.start();
put = new Put(TestBytes.row);
put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value3);
oldTxAware.put(put);
// Abort the third Put
transactionContext.abort();
// Get should now return the first value
transactionContext.start();
Result result = oldTxAware.get(new Get(TestBytes.row));
transactionContext.finish();
byte[] value = result.getValue(TestBytes.family, TestBytes.qualifier);
assertArrayEquals(TestBytes.value, value);
}
private static class OldTransactionAwareHTable extends TransactionAwareHTable {
public OldTransactionAwareHTable(Table hTable) {
super(hTable);
} | void function() throws Exception { TransactionAwareHTable oldTxAware = new OldTransactionAwareHTable(hTable); transactionContext.addTransactionAware(oldTxAware); transactionContext.start(); Put put = new Put(TestBytes.row); put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value); oldTxAware.put(put); transactionContext.finish(); transactionContext.start(); long txId = transactionContext.getCurrentTransaction().getTransactionId(); put = new Put(TestBytes.row); put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value2); oldTxAware.put(put); TransactionSystemClient txClient = new InMemoryTxSystemClient(txManager); txClient.invalidate(txId); transactionContext.start(); put = new Put(TestBytes.row); put.add(TestBytes.family, TestBytes.qualifier, TestBytes.value3); oldTxAware.put(put); transactionContext.abort(); transactionContext.start(); Result result = oldTxAware.get(new Get(TestBytes.row)); transactionContext.finish(); byte[] value = result.getValue(TestBytes.family, TestBytes.qualifier); assertArrayEquals(TestBytes.value, value); } private static class OldTransactionAwareHTable extends TransactionAwareHTable { public OldTransactionAwareHTable(Table hTable) { super(hTable); } | /**
* Tests that transaction co-processor works with older clients
*
* @throws Exception
*/ | Tests that transaction co-processor works with older clients | testOlderClientOperations | {
"repo_name": "poornachandra/incubator-tephra",
"path": "tephra-hbase-compat-1.1-base/src/test/java/org/apache/tephra/hbase/TransactionAwareHTableTest.java",
"license": "apache-2.0",
"size": 75534
} | [
"org.apache.hadoop.hbase.client.Get",
"org.apache.hadoop.hbase.client.Put",
"org.apache.hadoop.hbase.client.Result",
"org.apache.hadoop.hbase.client.Table",
"org.apache.tephra.TransactionSystemClient",
"org.apache.tephra.inmemory.InMemoryTxSystemClient",
"org.junit.Assert"
] | import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Table; import org.apache.tephra.TransactionSystemClient; import org.apache.tephra.inmemory.InMemoryTxSystemClient; import org.junit.Assert; | import org.apache.hadoop.hbase.client.*; import org.apache.tephra.*; import org.apache.tephra.inmemory.*; import org.junit.*; | [
"org.apache.hadoop",
"org.apache.tephra",
"org.junit"
] | org.apache.hadoop; org.apache.tephra; org.junit; | 1,330,581 |
@Deprecated
public int getPort() {
return ((ServerConnector)webServer.getConnectors()[0]).getLocalPort();
} | int function() { return ((ServerConnector)webServer.getConnectors()[0]).getLocalPort(); } | /**
* Get the port that the server is on
* @return the port
*/ | Get the port that the server is on | getPort | {
"repo_name": "ronny-macmaster/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java",
"license": "apache-2.0",
"size": 57814
} | [
"org.eclipse.jetty.server.ServerConnector"
] | import org.eclipse.jetty.server.ServerConnector; | import org.eclipse.jetty.server.*; | [
"org.eclipse.jetty"
] | org.eclipse.jetty; | 2,727,075 |
try {
if (OsUtil.isWin32()) {
Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler " + url);
}
else if (OsUtil.isMac()) {
try {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class c = cl.loadClass("com.apple.mrj.MRJFileUtils");
Class[] argtypes = {
String.class,
};
Method m = c.getMethod("openURL", argtypes);
Object[] args = {
url,
};
m.invoke(c.newInstance(), args);
} catch (Exception cnfe) {
//#if defined(LOGGING)
//@#$LPS-LOGGING:GranularityType:Statement
//@#$LPS-LOGGING:Localization:NestedStatement
LOG.error(cnfe);
LOG.info("Trying a default browser (netscape)");
//#endif
String[] commline = {
"netscape", url,
};
Runtime.getRuntime().exec(commline);
}
}
else {
Runtime.getRuntime().exec("firefox " + url);
}
}
catch (IOException ioe) {
// Didn't work.
//#if defined(LOGGING)
//@#$LPS-LOGGING:GranularityType:Statement
LOG.error(ioe);
//#endif
}
}
| try { if (OsUtil.isWin32()) { Runtime.getRuntime().exec( STR + url); } else if (OsUtil.isMac()) { try { ClassLoader cl = ClassLoader.getSystemClassLoader(); Class c = cl.loadClass(STR); Class[] argtypes = { String.class, }; Method m = c.getMethod(STR, argtypes); Object[] args = { url, }; m.invoke(c.newInstance(), args); } catch (Exception cnfe) { LOG.error(cnfe); LOG.info(STR); String[] commline = { STR, url, }; Runtime.getRuntime().exec(commline); } } else { Runtime.getRuntime().exec(STR + url); } } catch (IOException ioe) { LOG.error(ioe); } } | /**
* Open an URL in the system's default browser.
*
* @param url string containing the given URL
*/ | Open an URL in the system's default browser | openUrl | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/argouml_critics/argouml-app/src/org/argouml/util/osdep/StartBrowser.java",
"license": "gpl-3.0",
"size": 3641
} | [
"java.io.IOException",
"java.lang.reflect.Method"
] | import java.io.IOException; import java.lang.reflect.Method; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 523,063 |
private boolean isSkipStatement(DetailAST statement) {
return allowSingleLineStatement && isSingleLineStatement(statement);
} | boolean function(DetailAST statement) { return allowSingleLineStatement && isSingleLineStatement(statement); } | /**
* Checks if current statement can be skipped by "need braces" warning.
* @param statement if, for, while, do-while, lambda, else, case, default statements.
* @return true if current statement can be skipped by Check.
*/ | Checks if current statement can be skipped by "need braces" warning | isSkipStatement | {
"repo_name": "another-dave/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java",
"license": "lgpl-2.1",
"size": 13229
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 2,765,713 |
private static TreeImageDisplay transformTag(
TagAnnotationData data, long userID, long groupID)
{
if (data == null)
throw new IllegalArgumentException("Cannot be null");
TreeImageSet tag = new TreeImageSet(data);
formatToolTipFor(tag);
if (TagAnnotationData.INSIGHT_TAGSET_NS.equals(data.getNameSpace())) {
Set tags = data.getTags();
if (tags != null && tags.size() > 0) {
tag.setChildrenLoaded(Boolean.valueOf(true));
Iterator i = tags.iterator();
AnnotationData tmp;
while (i.hasNext()) {
tmp = (AnnotationData) i.next();
if (tmp instanceof TagAnnotationData)
tag.addChildDisplay(
transformTag((TagAnnotationData) tmp, userID,
groupID));
}
tag.setNumberItems(tags.size());
return tag;
}
tag.setChildrenLoaded(Boolean.valueOf(true));
tag.setNumberItems(0);
return tag;
}
Set dataObjects = data.getDataObjects();
//
if (dataObjects == null || dataObjects.size() == 0)
tag.setNumberItems(-1);
else {
tag.setChildrenLoaded(Boolean.valueOf(true));
tag.setNumberItems(dataObjects.size());
Iterator i = dataObjects.iterator();
DataObject tmp;
ProjectData p;
while (i.hasNext()) {
tmp = (DataObject) i.next();
if (EditorUtil.isReadable(tmp, userID, groupID)) {
if (tmp instanceof ImageData)
tag.addChildDisplay(transformImage((ImageData) tmp));
else if (tmp instanceof DatasetData)
tag.addChildDisplay(transformDataset((DatasetData) tmp,
userID, groupID));
else if (tmp instanceof ProjectData) {
p = (ProjectData) tmp;
tag.addChildDisplay(transformProject(p, p.getDatasets(),
userID, groupID));
}
}
}
}
return tag;
} | static TreeImageDisplay function( TagAnnotationData data, long userID, long groupID) { if (data == null) throw new IllegalArgumentException(STR); TreeImageSet tag = new TreeImageSet(data); formatToolTipFor(tag); if (TagAnnotationData.INSIGHT_TAGSET_NS.equals(data.getNameSpace())) { Set tags = data.getTags(); if (tags != null && tags.size() > 0) { tag.setChildrenLoaded(Boolean.valueOf(true)); Iterator i = tags.iterator(); AnnotationData tmp; while (i.hasNext()) { tmp = (AnnotationData) i.next(); if (tmp instanceof TagAnnotationData) tag.addChildDisplay( transformTag((TagAnnotationData) tmp, userID, groupID)); } tag.setNumberItems(tags.size()); return tag; } tag.setChildrenLoaded(Boolean.valueOf(true)); tag.setNumberItems(0); return tag; } Set dataObjects = data.getDataObjects(); tag.setNumberItems(-1); else { tag.setChildrenLoaded(Boolean.valueOf(true)); tag.setNumberItems(dataObjects.size()); Iterator i = dataObjects.iterator(); DataObject tmp; ProjectData p; while (i.hasNext()) { tmp = (DataObject) i.next(); if (EditorUtil.isReadable(tmp, userID, groupID)) { if (tmp instanceof ImageData) tag.addChildDisplay(transformImage((ImageData) tmp)); else if (tmp instanceof DatasetData) tag.addChildDisplay(transformDataset((DatasetData) tmp, userID, groupID)); else if (tmp instanceof ProjectData) { p = (ProjectData) tmp; tag.addChildDisplay(transformProject(p, p.getDatasets(), userID, groupID)); } } } } return tag; } | /**
* Transforms a {@link TagAnnotationData} into a visualisation object i.e.
* a {@link TreeImageSet}.
*
* @param data The {@link TagAnnotationData} to transform.
* Mustn't be <code>null</code>.
* @param userID The id of the current user.
* @param groupID The id of the group the current user selects when
* retrieving the data.
* @return See above.
*/ | Transforms a <code>TagAnnotationData</code> into a visualisation object i.e. a <code>TreeImageSet</code> | transformTag | {
"repo_name": "hflynn/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/util/browser/TreeViewerTranslator.java",
"license": "gpl-2.0",
"size": 36838
} | [
"java.util.Iterator",
"java.util.Set",
"org.openmicroscopy.shoola.agents.util.EditorUtil",
"org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay",
"org.openmicroscopy.shoola.agents.util.browser.TreeImageSet"
] | import java.util.Iterator; import java.util.Set; import org.openmicroscopy.shoola.agents.util.EditorUtil; import org.openmicroscopy.shoola.agents.util.browser.TreeImageDisplay; import org.openmicroscopy.shoola.agents.util.browser.TreeImageSet; | import java.util.*; import org.openmicroscopy.shoola.agents.util.*; import org.openmicroscopy.shoola.agents.util.browser.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 2,684,870 |
public void setHandle( DesignElementHandle handle )
{
this.handle = handle;
} | void function( DesignElementHandle handle ) { this.handle = handle; } | /**
* Sets chart's report handle.
*
* @param handle
*/ | Sets chart's report handle | setHandle | {
"repo_name": "sguan-actuate/birt",
"path": "chart/org.eclipse.birt.chart.reportitem/src/org/eclipse/birt/chart/reportitem/ChartStyleProcessorProxy.java",
"license": "epl-1.0",
"size": 2957
} | [
"org.eclipse.birt.report.model.api.DesignElementHandle"
] | import org.eclipse.birt.report.model.api.DesignElementHandle; | import org.eclipse.birt.report.model.api.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 2,222,513 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0))
{
return false;
}
else
{
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 5, 1, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 4, 2, 5, 4, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 4, 1, 0, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 2, 3, 3, 2, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 2, 3, 1, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 2, 3, 5, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 7, 4, 3, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 2, 1, 3, 2, Block.wood.blockID, Block.wood.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 2, 5, 3, 2, Block.wood.blockID, Block.wood.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 7, 1, 3, 7, Block.wood.blockID, Block.wood.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 7, 5, 3, 7, Block.wood.blockID, Block.wood.blockID, false);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 3, 2, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 3, 7, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 3, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 5, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.flowerPot.blockID, 7, 1, 3, 5, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 3, 2, 6, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.cauldron.blockID, 0, 4, 2, 6, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 1, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 5, 2, 1, par3StructureBoundingBox);
int i = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3);
int j = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1);
int k = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0);
int l = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 6, 4, 1, Block.stairsWoodSpruce.blockID, i, Block.stairsWoodSpruce.blockID, i, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 2, 0, 4, 7, Block.stairsWoodSpruce.blockID, k, Block.stairsWoodSpruce.blockID, k, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 6, 4, 2, 6, 4, 7, Block.stairsWoodSpruce.blockID, j, Block.stairsWoodSpruce.blockID, j, false);
this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 8, 6, 4, 8, Block.stairsWoodSpruce.blockID, l, Block.stairsWoodSpruce.blockID, l, false);
int i1;
int j1;
for (i1 = 2; i1 <= 7; i1 += 5)
{
for (j1 = 1; j1 <= 5; j1 += 4)
{
this.fillCurrentPositionBlocksDownwards(par1World, Block.wood.blockID, 0, j1, -1, i1, par3StructureBoundingBox);
}
}
if (!this.hasWitch)
{
i1 = this.getXWithOffset(2, 5);
j1 = this.getYWithOffset(2);
int k1 = this.getZWithOffset(2, 5);
if (par3StructureBoundingBox.isVecInside(i1, j1, k1))
{
this.hasWitch = true;
EntityWitch entitywitch = new EntityWitch(par1World);
entitywitch.setLocationAndAngles((double)i1 + 0.5D, (double)j1, (double)k1 + 0.5D, 0.0F, 0.0F);
entitywitch.onSpawnWithEgg((EntityLivingData)null);
par1World.spawnEntityInWorld(entitywitch);
}
}
return true;
}
} | boolean function(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0)) { return false; } else { this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 5, 1, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 4, 2, 5, 4, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 4, 1, 0, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 2, 3, 3, 2, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 2, 3, 1, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 2, 3, 5, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 7, 4, 3, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 2, 1, 3, 2, Block.wood.blockID, Block.wood.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 2, 5, 3, 2, Block.wood.blockID, Block.wood.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 7, 1, 3, 7, Block.wood.blockID, Block.wood.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 7, 5, 3, 7, Block.wood.blockID, Block.wood.blockID, false); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 3, 7, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 3, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.flowerPot.blockID, 7, 1, 3, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 3, 2, 6, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.cauldron.blockID, 0, 4, 2, 6, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 5, 2, 1, par3StructureBoundingBox); int i = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); int j = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1); int k = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0); int l = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 6, 4, 1, Block.stairsWoodSpruce.blockID, i, Block.stairsWoodSpruce.blockID, i, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 2, 0, 4, 7, Block.stairsWoodSpruce.blockID, k, Block.stairsWoodSpruce.blockID, k, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 6, 4, 2, 6, 4, 7, Block.stairsWoodSpruce.blockID, j, Block.stairsWoodSpruce.blockID, j, false); this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 8, 6, 4, 8, Block.stairsWoodSpruce.blockID, l, Block.stairsWoodSpruce.blockID, l, false); int i1; int j1; for (i1 = 2; i1 <= 7; i1 += 5) { for (j1 = 1; j1 <= 5; j1 += 4) { this.fillCurrentPositionBlocksDownwards(par1World, Block.wood.blockID, 0, j1, -1, i1, par3StructureBoundingBox); } } if (!this.hasWitch) { i1 = this.getXWithOffset(2, 5); j1 = this.getYWithOffset(2); int k1 = this.getZWithOffset(2, 5); if (par3StructureBoundingBox.isVecInside(i1, j1, k1)) { this.hasWitch = true; EntityWitch entitywitch = new EntityWitch(par1World); entitywitch.setLocationAndAngles((double)i1 + 0.5D, (double)j1, (double)k1 + 0.5D, 0.0F, 0.0F); entitywitch.onSpawnWithEgg((EntityLivingData)null); par1World.spawnEntityInWorld(entitywitch); } } return true; } } | /**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
* the end, it adds Fences...
*/ | second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences.. | addComponentParts | {
"repo_name": "HATB0T/RuneCraftery",
"path": "forge/mcp/src/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeatureSwampHut.java",
"license": "lgpl-3.0",
"size": 6249
} | [
"java.util.Random",
"net.minecraft.block.Block",
"net.minecraft.entity.EntityLivingData",
"net.minecraft.entity.monster.EntityWitch",
"net.minecraft.world.World"
] | import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingData; import net.minecraft.entity.monster.EntityWitch; import net.minecraft.world.World; | import java.util.*; import net.minecraft.block.*; import net.minecraft.entity.*; import net.minecraft.entity.monster.*; import net.minecraft.world.*; | [
"java.util",
"net.minecraft.block",
"net.minecraft.entity",
"net.minecraft.world"
] | java.util; net.minecraft.block; net.minecraft.entity; net.minecraft.world; | 2,389,381 |
public void setSearchResultRecord(IFeedRecord searchResultRecord) {
this._searchResultRecord = searchResultRecord;
} | void function(IFeedRecord searchResultRecord) { this._searchResultRecord = searchResultRecord; } | /**
* Sets the search result record.
*
* @param searchResultRecord
* the search result record
*/ | Sets the search result record | setSearchResultRecord | {
"repo_name": "Esri/geoportal-server",
"path": "geoportal/src/com/esri/gpt/catalog/search/MapViewerFlex.java",
"license": "apache-2.0",
"size": 10568
} | [
"com.esri.gpt.control.georss.IFeedRecord"
] | import com.esri.gpt.control.georss.IFeedRecord; | import com.esri.gpt.control.georss.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 1,634,431 |
protected void fetch(@Nonnull URI uri, @Nonnull @WillNotClose WritableByteChannel outputChannel) throws IOException {
HttpClient client = HttpClients.createMinimal();
HttpGet request = new HttpGet(uri);
HttpResponse response = client.execute(request);
StatusLine line = response.getStatusLine();
if (line.getStatusCode() != 200) {
throw new IOException("Unexpected status code: " + line.getStatusCode() + " - " + line.getReasonPhrase());
}
try (InputStream inputStream = response.getEntity().getContent()) {
try (ReadableByteChannel inputChannel = Channels.newChannel(inputStream)) {
ByteStreams.copy(inputChannel, outputChannel);
}
}
} | void function(@Nonnull URI uri, @Nonnull @WillNotClose WritableByteChannel outputChannel) throws IOException { HttpClient client = HttpClients.createMinimal(); HttpGet request = new HttpGet(uri); HttpResponse response = client.execute(request); StatusLine line = response.getStatusLine(); if (line.getStatusCode() != 200) { throw new IOException(STR + line.getStatusCode() + STR + line.getReasonPhrase()); } try (InputStream inputStream = response.getEntity().getContent()) { try (ReadableByteChannel inputChannel = Channels.newChannel(inputStream)) { ByteStreams.copy(inputChannel, outputChannel); } } } | /**
* Fetches any resource from a remote HTTP server and writes it to a supplied channel.
*/ | Fetches any resource from a remote HTTP server and writes it to a supplied channel | fetch | {
"repo_name": "BasinMC/minecraft-maven-plugin",
"path": "src/main/java/org/basinmc/maven/plugins/minecraft/AbstractArtifactMojo.java",
"license": "apache-2.0",
"size": 9222
} | [
"com.google.common.io.ByteStreams",
"java.io.IOException",
"java.io.InputStream",
"java.nio.channels.Channels",
"java.nio.channels.ReadableByteChannel",
"java.nio.channels.WritableByteChannel",
"javax.annotation.Nonnull",
"javax.annotation.WillNotClose",
"org.apache.http.HttpResponse",
"org.apache.http.StatusLine",
"org.apache.http.client.HttpClient",
"org.apache.http.client.methods.HttpGet",
"org.apache.http.impl.client.HttpClients"
] | import com.google.common.io.ByteStreams; import java.io.IOException; import java.io.InputStream; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; import javax.annotation.Nonnull; import javax.annotation.WillNotClose; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClients; | import com.google.common.io.*; import java.io.*; import java.nio.channels.*; import javax.annotation.*; import org.apache.http.*; import org.apache.http.client.*; import org.apache.http.client.methods.*; import org.apache.http.impl.client.*; | [
"com.google.common",
"java.io",
"java.nio",
"javax.annotation",
"org.apache.http"
] | com.google.common; java.io; java.nio; javax.annotation; org.apache.http; | 2,033,569 |
public final boolean run(boolean verbose)
throws IOException, InterruptedException, ClassNotFoundException {
// Most users won't hit this hopefully and can set it higher if desired
setIntConfIfDefault("mapreduce.job.counters.limit", 512);
// Capacity scheduler-specific settings. These should be enough for
// a reasonable Giraph job
setIntConfIfDefault("mapred.job.map.memory.mb", 1024);
setIntConfIfDefault("mapred.job.reduce.memory.mb", 0);
// Speculative execution doesn't make sense for Giraph
giraphConfiguration.setBoolean(
"mapred.map.tasks.speculative.execution", false);
// Set the ping interval to 5 minutes instead of one minute
// (DEFAULT_PING_INTERVAL)
Client.setPingInterval(giraphConfiguration, 60000 * 5);
// Should work in MAPREDUCE-1938 to let the user jars/classes
// get loaded first
giraphConfiguration.setBoolean("mapreduce.user.classpath.first", true);
giraphConfiguration.setBoolean("mapreduce.job.user.classpath.first", true);
// If the checkpoint frequency is 0 (no failure handling), set the max
// tasks attempts to be 0 to encourage faster failure of unrecoverable jobs
if (giraphConfiguration.getCheckpointFrequency() == 0) {
int oldMaxTaskAttempts = giraphConfiguration.getMaxTaskAttempts();
giraphConfiguration.setMaxTaskAttempts(0);
if (LOG.isInfoEnabled()) {
LOG.info("run: Since checkpointing is disabled (default), " +
"do not allow any task retries (setting " +
GiraphConstants.MAX_TASK_ATTEMPTS.getKey() + " = 0, " +
"old value = " + oldMaxTaskAttempts + ")");
}
}
// Set the job properties, check them, and submit the job
ImmutableClassesGiraphConfiguration conf =
new ImmutableClassesGiraphConfiguration(giraphConfiguration);
checkLocalJobRunnerConfiguration(conf);
Job submittedJob = new Job(conf, jobName);
if (submittedJob.getJar() == null) {
submittedJob.setJarByClass(getClass());
}
submittedJob.setNumReduceTasks(0);
submittedJob.setMapperClass(GraphMapper.class);
submittedJob.setInputFormatClass(BspInputFormat.class);
submittedJob.setOutputFormatClass(BspOutputFormat.class);
GiraphJobObserver jobObserver = conf.getJobObserver();
jobObserver.launchingJob(submittedJob);
boolean passed = submittedJob.waitForCompletion(verbose);
jobObserver.jobFinished(submittedJob, passed);
return passed;
} | final boolean function(boolean verbose) throws IOException, InterruptedException, ClassNotFoundException { setIntConfIfDefault(STR, 512); setIntConfIfDefault(STR, 1024); setIntConfIfDefault(STR, 0); giraphConfiguration.setBoolean( STR, false); Client.setPingInterval(giraphConfiguration, 60000 * 5); giraphConfiguration.setBoolean(STR, true); giraphConfiguration.setBoolean(STR, true); if (giraphConfiguration.getCheckpointFrequency() == 0) { int oldMaxTaskAttempts = giraphConfiguration.getMaxTaskAttempts(); giraphConfiguration.setMaxTaskAttempts(0); if (LOG.isInfoEnabled()) { LOG.info(STR + STR + GiraphConstants.MAX_TASK_ATTEMPTS.getKey() + STR + STR + oldMaxTaskAttempts + ")"); } } ImmutableClassesGiraphConfiguration conf = new ImmutableClassesGiraphConfiguration(giraphConfiguration); checkLocalJobRunnerConfiguration(conf); Job submittedJob = new Job(conf, jobName); if (submittedJob.getJar() == null) { submittedJob.setJarByClass(getClass()); } submittedJob.setNumReduceTasks(0); submittedJob.setMapperClass(GraphMapper.class); submittedJob.setInputFormatClass(BspInputFormat.class); submittedJob.setOutputFormatClass(BspOutputFormat.class); GiraphJobObserver jobObserver = conf.getJobObserver(); jobObserver.launchingJob(submittedJob); boolean passed = submittedJob.waitForCompletion(verbose); jobObserver.jobFinished(submittedJob, passed); return passed; } | /**
* Runs the actual graph application through Hadoop Map-Reduce.
*
* @param verbose If true, provide verbose output, false otherwise
* @return True if success, false otherwise
* @throws ClassNotFoundException
* @throws InterruptedException
* @throws IOException
*/ | Runs the actual graph application through Hadoop Map-Reduce | run | {
"repo_name": "skymanaditya1/giraph",
"path": "giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java",
"license": "apache-2.0",
"size": 8371
} | [
"java.io.IOException",
"org.apache.giraph.bsp.BspInputFormat",
"org.apache.giraph.bsp.BspOutputFormat",
"org.apache.giraph.conf.GiraphConstants",
"org.apache.giraph.conf.ImmutableClassesGiraphConfiguration",
"org.apache.giraph.graph.GraphMapper",
"org.apache.hadoop.ipc.Client",
"org.apache.hadoop.mapreduce.Job"
] | import java.io.IOException; import org.apache.giraph.bsp.BspInputFormat; import org.apache.giraph.bsp.BspOutputFormat; import org.apache.giraph.conf.GiraphConstants; import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; import org.apache.giraph.graph.GraphMapper; import org.apache.hadoop.ipc.Client; import org.apache.hadoop.mapreduce.Job; | import java.io.*; import org.apache.giraph.bsp.*; import org.apache.giraph.conf.*; import org.apache.giraph.graph.*; import org.apache.hadoop.ipc.*; import org.apache.hadoop.mapreduce.*; | [
"java.io",
"org.apache.giraph",
"org.apache.hadoop"
] | java.io; org.apache.giraph; org.apache.hadoop; | 582,404 |
default void renameColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle source, String target)
{
throw new PrestoException(NOT_SUPPORTED, "This connector does not support renaming columns");
} | default void renameColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle source, String target) { throw new PrestoException(NOT_SUPPORTED, STR); } | /**
* Rename the specified column
*/ | Rename the specified column | renameColumn | {
"repo_name": "kietly/presto",
"path": "presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java",
"license": "apache-2.0",
"size": 10735
} | [
"com.facebook.presto.spi.ColumnHandle",
"com.facebook.presto.spi.ConnectorSession",
"com.facebook.presto.spi.ConnectorTableHandle",
"com.facebook.presto.spi.PrestoException"
] | import com.facebook.presto.spi.ColumnHandle; import com.facebook.presto.spi.ConnectorSession; import com.facebook.presto.spi.ConnectorTableHandle; import com.facebook.presto.spi.PrestoException; | import com.facebook.presto.spi.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 178,022 |
public void setMaxHeaderTableSize(OutputStream out, int maxHeaderTableSize) throws IOException {
if (maxHeaderTableSize < 0) {
throw new IllegalArgumentException("Illegal Capacity: " + maxHeaderTableSize);
}
if (capacity == maxHeaderTableSize) {
return;
}
capacity = maxHeaderTableSize;
ensureCapacity(0);
encodeInteger(out, 0x20, 5, maxHeaderTableSize);
} | void function(OutputStream out, int maxHeaderTableSize) throws IOException { if (maxHeaderTableSize < 0) { throw new IllegalArgumentException(STR + maxHeaderTableSize); } if (capacity == maxHeaderTableSize) { return; } capacity = maxHeaderTableSize; ensureCapacity(0); encodeInteger(out, 0x20, 5, maxHeaderTableSize); } | /**
* Set the maximum table size.
*/ | Set the maximum table size | setMaxHeaderTableSize | {
"repo_name": "yrcourage/netty",
"path": "codec-http2/src/main/java/io/netty/handler/codec/http2/internal/hpack/Encoder.java",
"license": "apache-2.0",
"size": 15097
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 965,703 |
private void initFonts() {
if (fontTitle == null) {
fontTitle = labelTitle.getFont();
fontTitleBold = fontTitle.deriveFont(Font.BOLD);
fontLabel = labelCurrentVersion.getFont();
fontLabelBold = fontLabel.deriveFont(Font.BOLD);
}
}
| void function() { if (fontTitle == null) { fontTitle = labelTitle.getFont(); fontTitleBold = fontTitle.deriveFont(Font.BOLD); fontLabel = labelCurrentVersion.getFont(); fontLabelBold = fontLabel.deriveFont(Font.BOLD); } } | /**
* Init the fonts of the renderer.
*/ | Init the fonts of the renderer | initFonts | {
"repo_name": "wichtounet/jtheque-core",
"path": "jtheque-views/src/main/java/org/jtheque/views/impl/components/renderers/ModuleListRenderer.java",
"license": "apache-2.0",
"size": 6550
} | [
"java.awt.Font"
] | import java.awt.Font; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,758,017 |
private Map<String, String> getHostWithSchemeMappingForLabel(List<Label> gatewayLabels, String labelName)
throws APIManagementException {
Map<String, String> hostsWithSchemes = new HashMap<>();
Label labelObj = null;
for (Label label : gatewayLabels) {
if (label.getName().equals(labelName)) {
labelObj = label;
break;
}
}
if (labelObj == null) {
handleException(
"Could not find provided label '" + labelName);
return null;
}
List<String> accessUrls = labelObj.getAccessUrls();
for (String url : accessUrls) {
if (url.startsWith(APIConstants.HTTPS_PROTOCOL_URL_PREFIX)) {
hostsWithSchemes.put(APIConstants.HTTPS_PROTOCOL, url);
}
if (url.startsWith(APIConstants.HTTP_PROTOCOL_URL_PREFIX)) {
hostsWithSchemes.put(APIConstants.HTTP_PROTOCOL, url);
}
}
return hostsWithSchemes;
} | Map<String, String> function(List<Label> gatewayLabels, String labelName) throws APIManagementException { Map<String, String> hostsWithSchemes = new HashMap<>(); Label labelObj = null; for (Label label : gatewayLabels) { if (label.getName().equals(labelName)) { labelObj = label; break; } } if (labelObj == null) { handleException( STR + labelName); return null; } List<String> accessUrls = labelObj.getAccessUrls(); for (String url : accessUrls) { if (url.startsWith(APIConstants.HTTPS_PROTOCOL_URL_PREFIX)) { hostsWithSchemes.put(APIConstants.HTTPS_PROTOCOL, url); } if (url.startsWith(APIConstants.HTTP_PROTOCOL_URL_PREFIX)) { hostsWithSchemes.put(APIConstants.HTTP_PROTOCOL, url); } } return hostsWithSchemes; } | /**
* Get gateway host names with transport scheme mapping.
*
* @param gatewayLabels gateway label list
* @param labelName Label name
* @return Hostname with transport schemes
* @throws APIManagementException If an error occurs when getting gateway host names.
*/ | Get gateway host names with transport scheme mapping | getHostWithSchemeMappingForLabel | {
"repo_name": "chamindias/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java",
"license": "apache-2.0",
"size": 331473
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.Label"
] | import java.util.HashMap; import java.util.List; import java.util.Map; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Label; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 79,580 |
public ArrayList<RCSNode> getLevelChildren() {
return levelChildren;
} | ArrayList<RCSNode> function() { return levelChildren; } | /**
* Returns this node's list of children in the levelgraph
*
* @return list of children
*/ | Returns this node's list of children in the levelgraph | getLevelChildren | {
"repo_name": "r-kober/ReCaLys",
"path": "ReCaLys/src/de/upb/recalys/model/RCSNode.java",
"license": "mit",
"size": 12318
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,498,754 |
int size = 13;
String tooltip;
setPreferredSize(new Dimension(size, size));
tooltip = SunsetBundle.getInstance().getProperty("button_closetab");
if(tooltip!=null){
setToolTipText(tooltip);
}else{
setToolTipText("close this tab");
}
//Make the button looks the same for all Laf's
setUI(new BasicButtonUI());
//Make it transparent
setContentAreaFilled(false);
//No need to be focusable
setFocusable(false);
setBorder(BorderFactory.createEtchedBorder());
setBorderPainted(false);
addActionListener(this);
setRolloverEnabled(true);
} | int size = 13; String tooltip; setPreferredSize(new Dimension(size, size)); tooltip = SunsetBundle.getInstance().getProperty(STR); if(tooltip!=null){ setToolTipText(tooltip); }else{ setToolTipText(STR); } setUI(new BasicButtonUI()); setContentAreaFilled(false); setFocusable(false); setBorder(BorderFactory.createEtchedBorder()); setBorderPainted(false); addActionListener(this); setRolloverEnabled(true); } | /**
* Inits the button
*/ | Inits the button | initButton | {
"repo_name": "stefan-rass/sunset-ffapl",
"path": "src/sunset/gui/button/TabCloseButton.java",
"license": "gpl-3.0",
"size": 1795
} | [
"java.awt.Dimension",
"javax.swing.BorderFactory",
"javax.swing.plaf.basic.BasicButtonUI"
] | import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.plaf.basic.BasicButtonUI; | import java.awt.*; import javax.swing.*; import javax.swing.plaf.basic.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 309,182 |
@Override
public void addChildArea(Area childArea) {
if (childArea instanceof InlineArea) {
addInlineArea((InlineArea)childArea);
// set the parent area for the child area
((InlineArea)childArea).setParentArea(this);
}
} | void function(Area childArea) { if (childArea instanceof InlineArea) { addInlineArea((InlineArea)childArea); ((InlineArea)childArea).setParentArea(this); } } | /**
* Add a child area to this line area.
*
* @param childArea the inline child area to add
*/ | Add a child area to this line area | addChildArea | {
"repo_name": "Distrotech/fop",
"path": "src/java/org/apache/fop/area/LineArea.java",
"license": "apache-2.0",
"size": 10063
} | [
"org.apache.fop.area.inline.InlineArea"
] | import org.apache.fop.area.inline.InlineArea; | import org.apache.fop.area.inline.*; | [
"org.apache.fop"
] | org.apache.fop; | 214,019 |
public final void setGrouping(final boolean grouping) {
fGrouping= grouping;
}
/**
* Sets the disjunction of search patterns to be used during search.
* <p>
* This method must be called before {@link RefactoringSearchEngine2#searchPattern(IProgressMonitor)} | final void function(final boolean grouping) { fGrouping= grouping; } /** * Sets the disjunction of search patterns to be used during search. * <p> * This method must be called before {@link RefactoringSearchEngine2#searchPattern(IProgressMonitor)} | /**
* Determines how search matches are grouped.
* <p>
* This method must be called before start searching. The default is to group by containing resource.
*
* @param grouping <code>true</code> to group matches by their containing resource, <code>false</code> otherwise
*/ | Determines how search matches are grouped. This method must be called before start searching. The default is to group by containing resource | setGrouping | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/corext/refactoring/RefactoringSearchEngine2.java",
"license": "epl-1.0",
"size": 25701
} | [
"org.eclipse.core.runtime.IProgressMonitor"
] | import org.eclipse.core.runtime.IProgressMonitor; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,373,302 |
public void getResults(ContentName baseName, int count, CCNHandle handle) throws IOException, InvalidKeyException, SignatureException, InterruptedException {
Random rand = new Random();
// boolean done = false;
Log.info(Log.FAC_TEST, "getResults: getting children of " + baseName);
for (int i = 0; i < count; i++) {
// while (!done) {
Thread.sleep(rand.nextInt(50));
Log.info(Log.FAC_TEST, "getResults getting " + baseName + " subitem " + i);
ContentObject contents = handle.get(new ContentName(baseName, Integer.toString(i)), SystemConfiguration.NO_TIMEOUT);
try {
int val = Integer.parseInt(new String(contents.content()));
if (_resultSet.contains(val)) {
Log.info(Log.FAC_TEST, "Got " + val + " again.");
} else {
Log.info(Log.FAC_TEST, "Got " + val);
}
_resultSet.add(val);
} catch (NumberFormatException nfe) {
Log.info(Log.FAC_TEST, "BaseLibraryTest: unexpected content - not integer. Name: " + contents.content());
}
//assertEquals(i, Integer.parseInt(new String(contents.get(0).content())));
checkGetResults(contents);
if (_resultSet.size() == count) {
Log.info(Log.FAC_TEST, "We have everything!");
// done = true;
}
}
return;
}
| void function(ContentName baseName, int count, CCNHandle handle) throws IOException, InvalidKeyException, SignatureException, InterruptedException { Random rand = new Random(); Log.info(Log.FAC_TEST, STR + baseName); for (int i = 0; i < count; i++) { Thread.sleep(rand.nextInt(50)); Log.info(Log.FAC_TEST, STR + baseName + STR + i); ContentObject contents = handle.get(new ContentName(baseName, Integer.toString(i)), SystemConfiguration.NO_TIMEOUT); try { int val = Integer.parseInt(new String(contents.content())); if (_resultSet.contains(val)) { Log.info(Log.FAC_TEST, STR + val + STR); } else { Log.info(Log.FAC_TEST, STR + val); } _resultSet.add(val); } catch (NumberFormatException nfe) { Log.info(Log.FAC_TEST, STR + contents.content()); } checkGetResults(contents); if (_resultSet.size() == count) { Log.info(Log.FAC_TEST, STR); } } return; } | /**
* Expects this method to call checkGetResults on each set of content returned...
* @param baseName
* @param count
* @param handle
* @return
* @throws InterruptedException
* @throws IOException
* @throws SignatureException
* @throws InvalidKeyException
* @throws InterruptedException
*/ | Expects this method to call checkGetResults on each set of content returned.. | getResults | {
"repo_name": "ebollens/ccnmp",
"path": "javasrc/src/org/ccnx/ccn/test/LibraryTestBase.java",
"license": "lgpl-2.1",
"size": 13458
} | [
"java.io.IOException",
"java.security.InvalidKeyException",
"java.security.SignatureException",
"java.util.Random",
"org.ccnx.ccn.CCNHandle",
"org.ccnx.ccn.config.SystemConfiguration",
"org.ccnx.ccn.impl.support.Log",
"org.ccnx.ccn.protocol.ContentName",
"org.ccnx.ccn.protocol.ContentObject"
] | import java.io.IOException; import java.security.InvalidKeyException; import java.security.SignatureException; import java.util.Random; import org.ccnx.ccn.CCNHandle; import org.ccnx.ccn.config.SystemConfiguration; import org.ccnx.ccn.impl.support.Log; import org.ccnx.ccn.protocol.ContentName; import org.ccnx.ccn.protocol.ContentObject; | import java.io.*; import java.security.*; import java.util.*; import org.ccnx.ccn.*; import org.ccnx.ccn.config.*; import org.ccnx.ccn.impl.support.*; import org.ccnx.ccn.protocol.*; | [
"java.io",
"java.security",
"java.util",
"org.ccnx.ccn"
] | java.io; java.security; java.util; org.ccnx.ccn; | 2,733,844 |
public OffsetCallback<DatasetContext> getHoverOffsetCallback() {
return hoverOffsetCallback;
} | OffsetCallback<DatasetContext> function() { return hoverOffsetCallback; } | /**
* Returns the offset callback, when dataset is hovered, if set, otherwise <code>null</code>.
*
* @return the offset callback, when dataset is hovered, if set, otherwise <code>null</code>.
*/ | Returns the offset callback, when dataset is hovered, if set, otherwise <code>null</code> | getHoverOffsetCallback | {
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/data/PieDataset.java",
"license": "apache-2.0",
"size": 23128
} | [
"org.pepstock.charba.client.callbacks.DatasetContext",
"org.pepstock.charba.client.callbacks.OffsetCallback"
] | import org.pepstock.charba.client.callbacks.DatasetContext; import org.pepstock.charba.client.callbacks.OffsetCallback; | import org.pepstock.charba.client.callbacks.*; | [
"org.pepstock.charba"
] | org.pepstock.charba; | 2,176,478 |
public void deleteVersion(Inode node, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException; | void function(Inode node, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException; | /**
* Deletes the given version of the node from the system
*
* @param node
* @param user
* @param respectFrontendRoles
*/ | Deletes the given version of the node from the system | deleteVersion | {
"repo_name": "wisdom-garden/dotcms",
"path": "src/com/dotmarketing/business/skeleton/DotCMSAPI.java",
"license": "gpl-3.0",
"size": 24636
} | [
"com.dotmarketing.beans.Inode",
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.exception.DotSecurityException",
"com.liferay.portal.model.User"
] | import com.dotmarketing.beans.Inode; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.liferay.portal.model.User; | import com.dotmarketing.beans.*; import com.dotmarketing.exception.*; import com.liferay.portal.model.*; | [
"com.dotmarketing.beans",
"com.dotmarketing.exception",
"com.liferay.portal"
] | com.dotmarketing.beans; com.dotmarketing.exception; com.liferay.portal; | 1,222,936 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.