method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public boolean isShowAudio() { return ServerConfigurationService.getBoolean("samigo.question.show.audio",showAudio); }
boolean function() { return ServerConfigurationService.getBoolean(STR,showAudio); }
/** * Should we show audio upload question? * @return if true */
Should we show audio upload question
isShowAudio
{ "repo_name": "payten/nyu-sakai-10.4", "path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/author/ItemConfigBean.java", "license": "apache-2.0", "size": 14626 }
[ "org.sakaiproject.component.cover.ServerConfigurationService" ]
import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.component.cover.*;
[ "org.sakaiproject.component" ]
org.sakaiproject.component;
2,314,648
@Nonnull public List<Category> readAllCategories();
List<Category> function();
/** * Retrieve all categories in the datastore * * @return a list of all the {@code Category} instances in the datastore */
Retrieve all categories in the datastore
readAllCategories
{ "repo_name": "passion1014/metaworks_framework", "path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/catalog/dao/CategoryDao.java", "license": "apache-2.0", "size": 7887 }
[ "java.util.List", "org.broadleafcommerce.core.catalog.domain.Category" ]
import java.util.List; import org.broadleafcommerce.core.catalog.domain.Category;
import java.util.*; import org.broadleafcommerce.core.catalog.domain.*;
[ "java.util", "org.broadleafcommerce.core" ]
java.util; org.broadleafcommerce.core;
2,329,041
protected void runUpload(Integer numOfThreads, HashMap<String, String> attributes, Boolean createNewVersion, Boolean force, String hostname, String storageName) throws Exception { String hostnameToUse = hostname == null ? WEB_SERVICE_HOSTNAME : hostname; // Create local data files in LOCAL_TEMP_PATH_INPUT directory for (ManifestFile manifestFile : testManifestFiles) { createLocalFile(LOCAL_TEMP_PATH_INPUT.toString(), manifestFile.getFileName(), FILE_SIZE_1_KB); } // Create uploader input manifest file in LOCAL_TEMP_PATH_INPUT directory UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto(); uploaderInputManifestDto.setAttributes(attributes); uploaderInputManifestDto.setStorageName(storageName); File manifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto); Assert.assertTrue(manifestFile.isFile()); // Perform the upload. S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = getTestS3FileTransferRequestParamsDto(); s3FileTransferRequestParamsDto.setLocalPath(LOCAL_TEMP_PATH_INPUT.toString()); s3FileTransferRequestParamsDto.setMaxThreads(numOfThreads); RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(hostnameToUse).withRegServerPort(WEB_SERVICE_HTTPS_PORT).withUseSsl(true) .withUsername(WEB_SERVICE_HTTPS_USERNAME).withPassword(WEB_SERVICE_HTTPS_PASSWORD).withTrustSelfSignedCertificate(true) .withDisableHostnameVerification(true).build(); uploaderController.performUpload(regServerAccessParamsDto, manifestFile, s3FileTransferRequestParamsDto, createNewVersion, force, TEST_RETRY_ATTEMPTS, TEST_RETRY_DELAY_SECS); }
void function(Integer numOfThreads, HashMap<String, String> attributes, Boolean createNewVersion, Boolean force, String hostname, String storageName) throws Exception { String hostnameToUse = hostname == null ? WEB_SERVICE_HOSTNAME : hostname; for (ManifestFile manifestFile : testManifestFiles) { createLocalFile(LOCAL_TEMP_PATH_INPUT.toString(), manifestFile.getFileName(), FILE_SIZE_1_KB); } UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto(); uploaderInputManifestDto.setAttributes(attributes); uploaderInputManifestDto.setStorageName(storageName); File manifestFile = createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto); Assert.assertTrue(manifestFile.isFile()); S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = getTestS3FileTransferRequestParamsDto(); s3FileTransferRequestParamsDto.setLocalPath(LOCAL_TEMP_PATH_INPUT.toString()); s3FileTransferRequestParamsDto.setMaxThreads(numOfThreads); RegServerAccessParamsDto regServerAccessParamsDto = RegServerAccessParamsDto.builder().withRegServerHost(hostnameToUse).withRegServerPort(WEB_SERVICE_HTTPS_PORT).withUseSsl(true) .withUsername(WEB_SERVICE_HTTPS_USERNAME).withPassword(WEB_SERVICE_HTTPS_PASSWORD).withTrustSelfSignedCertificate(true) .withDisableHostnameVerification(true).build(); uploaderController.performUpload(regServerAccessParamsDto, manifestFile, s3FileTransferRequestParamsDto, createNewVersion, force, TEST_RETRY_ATTEMPTS, TEST_RETRY_DELAY_SECS); }
/** * Runs a normal upload scenario. * * @param numOfThreads the maximum number of threads to use for file transfer to S3 * @param attributes the attributes to be associated with the test data being uploaded * @param createNewVersion if not set, only initial version of the business object data is allowed to be created * @param force if set, allows upload to proceed when the latest version of the business object data has UPLOADING status by invalidating that version * @param hostname optional override of the default web service hostname. * @param storageName optional storage name */
Runs a normal upload scenario
runUpload
{ "repo_name": "FINRAOS/herd", "path": "herd-code/herd-tools/herd-uploader/src/test/java/org/finra/herd/tools/uploader/UploaderControllerTest.java", "license": "apache-2.0", "size": 20539 }
[ "java.io.File", "java.util.HashMap", "org.finra.herd.model.dto.RegServerAccessParamsDto", "org.finra.herd.model.dto.S3FileTransferRequestParamsDto", "org.finra.herd.tools.common.dto.ManifestFile", "org.finra.herd.tools.common.dto.UploaderInputManifestDto", "org.junit.Assert" ]
import java.io.File; import java.util.HashMap; import org.finra.herd.model.dto.RegServerAccessParamsDto; import org.finra.herd.model.dto.S3FileTransferRequestParamsDto; import org.finra.herd.tools.common.dto.ManifestFile; import org.finra.herd.tools.common.dto.UploaderInputManifestDto; import org.junit.Assert;
import java.io.*; import java.util.*; import org.finra.herd.model.dto.*; import org.finra.herd.tools.common.dto.*; import org.junit.*;
[ "java.io", "java.util", "org.finra.herd", "org.junit" ]
java.io; java.util; org.finra.herd; org.junit;
320,099
private static void connectPropertyModel( AllPasswordsBottomSheetViewHolder holder, MVCListAdapter.ListItem item) { holder.setupModelChangeProcessor(item.model); }
static void function( AllPasswordsBottomSheetViewHolder holder, MVCListAdapter.ListItem item) { holder.setupModelChangeProcessor(item.model); }
/** * This method creates a model change processor for each recycler view item when it is created. * @param holder A {@link AllPasswordsBottomSheetViewHolder} holding the view and view binder * for the MCP. * @param item A {@link MVCListAdapter.ListItem} holding the {@link PropertyModel} for the MCP. */
This method creates a model change processor for each recycler view item when it is created
connectPropertyModel
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/android/features/keyboard_accessory/internal/java/src/org/chromium/chrome/browser/keyboard_accessory/all_passwords_bottom_sheet/AllPasswordsBottomSheetViewBinder.java", "license": "bsd-3-clause", "size": 11005 }
[ "org.chromium.ui.modelutil.MVCListAdapter" ]
import org.chromium.ui.modelutil.MVCListAdapter;
import org.chromium.ui.modelutil.*;
[ "org.chromium.ui" ]
org.chromium.ui;
2,772,782
public void setAlpha(ControlParameter alpha) { this.alpha = alpha; }
void function(ControlParameter alpha) { this.alpha = alpha; }
/** * Set the {@code alpha} {@linkplain ControlParameter}. * * @param alpha the {@code alpha} {@linkplain ControlParameter}. */
Set the alpha ControlParameter
setAlpha
{ "repo_name": "filinep/cilib", "path": "library/src/main/java/net/sourceforge/cilib/functions/continuous/unconstrained/Yang3.java", "license": "gpl-3.0", "size": 2743 }
[ "net.sourceforge.cilib.controlparameter.ControlParameter" ]
import net.sourceforge.cilib.controlparameter.ControlParameter;
import net.sourceforge.cilib.controlparameter.*;
[ "net.sourceforge.cilib" ]
net.sourceforge.cilib;
1,243,880
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters);
/** * Creates or updates a route filter in a specified resource group. * * @param resourceGroupName The name of the resource group. * @param routeFilterName The name of the route filter. * @param routeFilterParameters Parameters supplied to the create or update route filter operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return route Filter Resource along with {@link Response} on successful completion of {@link Mono}. */
Creates or updates a route filter in a specified resource group
createOrUpdateWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/RouteFiltersClient.java", "license": "mit", "size": 23978 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.network.fluent.models.RouteFilterInner", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.network.fluent.models.RouteFilterInner; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
2,399,690
public long subCost(ArrayList<FromItem> fromList) { return _sub.subCost(fromList); }
long function(ArrayList<FromItem> fromList) { return _sub.subCost(fromList); }
/** * Returns the cost based on the given FromList. */
Returns the cost based on the given FromList
subCost
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/db/sql/NotExpr.java", "license": "gpl-2.0", "size": 3048 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
113,702
public synchronized TableScanner getScanner(RangeSplit split, boolean closeReader) throws IOException, ParseException { checkInferredMapping(); return new BTScanner(split, partition, closeReader); }
synchronized TableScanner function(RangeSplit split, boolean closeReader) throws IOException, ParseException { checkInferredMapping(); return new BTScanner(split, partition, closeReader); }
/** * Get a scanner that reads a consecutive number of rows as defined in the * {@link RangeSplit} object, which should be obtained from previous calls * of {@link #rangeSplit(int)}. * * @param split * The split range. If null, get a scanner to read the complete * table. * @param closeReader * close the underlying Reader object when we close the scanner. * Should be set to true if we have only one scanner on top of the * reader, so that we should release resources after the scanner is * closed. * @return A scanner object. * @throws IOException */
Get a scanner that reads a consecutive number of rows as defined in the <code>RangeSplit</code> object, which should be obtained from previous calls of <code>#rangeSplit(int)</code>
getScanner
{ "repo_name": "bigfootproject/AutoRollup", "path": "contrib/zebra/src/java/org/apache/hadoop/zebra/io/BasicTable.java", "license": "apache-2.0", "size": 71452 }
[ "java.io.IOException", "org.apache.hadoop.zebra.parser.ParseException" ]
import java.io.IOException; import org.apache.hadoop.zebra.parser.ParseException;
import java.io.*; import org.apache.hadoop.zebra.parser.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,120,533
final void postComplete(final int commitflag, final boolean commitOrAbort) throws StandardException { try { if (GemFireXDUtils.TraceTran || GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_TRAN, "postComplete: flag=" + commitflag + ", commitOrAbort=" + commitOrAbort + " for TX " + toString()); } if ((commitflag & Transaction.KEEP_LOCKS) == 0) { releaseAllLocksOnly(true, true); setIdleState(); } else { SanityManager.ASSERT(commitOrAbort, "cannot keep locks around after an ABORT"); // we have unreleased locks, the transaction has resource and // therefore is "active" setActiveState(); } } finally { this.release(); } }
final void postComplete(final int commitflag, final boolean commitOrAbort) throws StandardException { try { if (GemFireXDUtils.TraceTran GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_TRAN, STR + commitflag + STR + commitOrAbort + STR + toString()); } if ((commitflag & Transaction.KEEP_LOCKS) == 0) { releaseAllLocksOnly(true, true); setIdleState(); } else { SanityManager.ASSERT(commitOrAbort, STR); setActiveState(); } } finally { this.release(); } }
/** * DOCUMENT ME! * * @param commitflag * DOCUMENT ME! * @param commitOrAbort * DOCUMENT ME! * * @throws StandardException * DOCUMENT ME! */
DOCUMENT ME
postComplete
{ "repo_name": "papicella/snappy-store", "path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/access/GemFireTransaction.java", "license": "apache-2.0", "size": 148971 }
[ "com.pivotal.gemfirexd.internal.engine.GfxdConstants", "com.pivotal.gemfirexd.internal.engine.distributed.utils.GemFireXDUtils", "com.pivotal.gemfirexd.internal.iapi.error.StandardException", "com.pivotal.gemfirexd.internal.iapi.store.raw.Transaction", "com.pivotal.gemfirexd.internal.shared.common.sanity.SanityManager" ]
import com.pivotal.gemfirexd.internal.engine.GfxdConstants; import com.pivotal.gemfirexd.internal.engine.distributed.utils.GemFireXDUtils; import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.store.raw.Transaction; import com.pivotal.gemfirexd.internal.shared.common.sanity.SanityManager;
import com.pivotal.gemfirexd.internal.engine.*; import com.pivotal.gemfirexd.internal.engine.distributed.utils.*; import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.store.raw.*; import com.pivotal.gemfirexd.internal.shared.common.sanity.*;
[ "com.pivotal.gemfirexd" ]
com.pivotal.gemfirexd;
472,038
public static boolean isAuthorized(PerunSession sess, Role role, PerunBean complementaryObject) throws InternalErrorException { log.trace("Entering isAuthorized: sess='" + sess + "', role='" + role + "', complementaryObject='" + complementaryObject + "'"); Utils.notNull(sess, "sess"); // We need to load additional information about the principal if (!sess.getPerunPrincipal().isAuthzInitialized()) { init(sess); } // If the user has no roles, deny access if (sess.getPerunPrincipal().getRoles() == null) { return false; } // Perun admin can do anything if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } // If user doesn't have requested role, deny request if (!sess.getPerunPrincipal().getRoles().hasRole(role)) { return false; } // Check if the principal has the privileges if (complementaryObject != null) { String beanName = BeansUtils.convertRichBeanNameToBeanName(complementaryObject.getBeanName()); // Check various combinations of role and complementary objects if (role.equals(Role.VOADMIN) || role.equals(Role.VOOBSERVER)) { // VO admin (or VoObserver) and group, get vo id from group and check if the user is vo admin (or VoObserver) if (beanName.equals(Group.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Group) complementaryObject).getVoId()); } // VO admin (or VoObserver) and resource, check if the user is vo admin (or VoObserver) if (beanName.equals(Resource.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Resource) complementaryObject).getVoId()); } // VO admin (or VoObserver) and member, check if the member is from that VO if (beanName.equals(Member.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Member) complementaryObject).getVoId()); } } else if (role.equals(Role.FACILITYADMIN)) { // Facility admin and resource, get facility id from resource and check if the user is facility admin if (beanName.equals(Resource.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Facility.class.getSimpleName(), ((Resource) complementaryObject).getFacilityId()); } } else if (role.equals(Role.SECURITYADMIN)) { // Security admin, check if security admin is admin of the SecurityTeam if (beanName.equals(SecurityTeam.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, SecurityTeam.class.getSimpleName(), ((SecurityTeam) complementaryObject).getId()); } } else if (role.equals(Role.GROUPADMIN) || role.equals(Role.TOPGROUPCREATOR)) { // Group admin can see some of the date of the VO if (beanName.equals(Vo.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Vo) complementaryObject).getId()); } } else if (role.equals(Role.SELF)) { // Check if the member belogs to the self role if (beanName.equals(Member.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, User.class.getSimpleName(), ((Member) complementaryObject).getUserId()); } } return sess.getPerunPrincipal().getRoles().hasRole(role, complementaryObject); } else { return true; } }
static boolean function(PerunSession sess, Role role, PerunBean complementaryObject) throws InternalErrorException { log.trace(STR + sess + STR + role + STR + complementaryObject + "'"); Utils.notNull(sess, "sess"); if (!sess.getPerunPrincipal().isAuthzInitialized()) { init(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } if (!sess.getPerunPrincipal().getRoles().hasRole(role)) { return false; } if (complementaryObject != null) { String beanName = BeansUtils.convertRichBeanNameToBeanName(complementaryObject.getBeanName()); if (role.equals(Role.VOADMIN) role.equals(Role.VOOBSERVER)) { if (beanName.equals(Group.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Group) complementaryObject).getVoId()); } if (beanName.equals(Resource.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Resource) complementaryObject).getVoId()); } if (beanName.equals(Member.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Member) complementaryObject).getVoId()); } } else if (role.equals(Role.FACILITYADMIN)) { if (beanName.equals(Resource.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Facility.class.getSimpleName(), ((Resource) complementaryObject).getFacilityId()); } } else if (role.equals(Role.SECURITYADMIN)) { if (beanName.equals(SecurityTeam.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, SecurityTeam.class.getSimpleName(), ((SecurityTeam) complementaryObject).getId()); } } else if (role.equals(Role.GROUPADMIN) role.equals(Role.TOPGROUPCREATOR)) { if (beanName.equals(Vo.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, Vo.class.getSimpleName(), ((Vo) complementaryObject).getId()); } } else if (role.equals(Role.SELF)) { if (beanName.equals(Member.class.getSimpleName())) { return sess.getPerunPrincipal().getRoles().hasRole(role, User.class.getSimpleName(), ((Member) complementaryObject).getUserId()); } } return sess.getPerunPrincipal().getRoles().hasRole(role, complementaryObject); } else { return true; } }
/** * Checks if the principal is authorized. * * @param sess perunSession * @param role required role * @param complementaryObject object which specifies particular action of the role (e.g. group) * @return true if the principal authorized, false otherwise * @throws InternalErrorException if something goes wrong */
Checks if the principal is authorized
isAuthorized
{ "repo_name": "Holdo/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/AuthzResolverBlImpl.java", "license": "bsd-2-clause", "size": 64120 }
[ "cz.metacentrum.perun.core.api.BeansUtils", "cz.metacentrum.perun.core.api.Facility", "cz.metacentrum.perun.core.api.Group", "cz.metacentrum.perun.core.api.Member", "cz.metacentrum.perun.core.api.PerunBean", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.Resource", "cz.metacentrum.perun.core.api.Role", "cz.metacentrum.perun.core.api.SecurityTeam", "cz.metacentrum.perun.core.api.User", "cz.metacentrum.perun.core.api.Vo", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.impl.Utils" ]
import cz.metacentrum.perun.core.api.BeansUtils; import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.Group; import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunBean; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Resource; import cz.metacentrum.perun.core.api.Role; import cz.metacentrum.perun.core.api.SecurityTeam; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.Vo; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.impl.Utils;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import cz.metacentrum.perun.core.impl.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
2,407,998
public void createFilter(List<String> users, String from, String to, String subject, String hasTheWord, String doesNotHaveTheWord, boolean hasAttachment, boolean shouldMarkAsRead, boolean shouldArchive, String label, String forwardTo, boolean neverSpam, boolean shouldStar, boolean shouldTrash) throws IllegalArgumentException, ServiceException, MalformedURLException, IOException { if (users.size() == 0) { throw new IllegalArgumentException(); } GenericEntry entry = new GenericEntry(); entry.addProperty(Constants.FROM, from); entry.addProperty(Constants.TO, to); entry.addProperty(Constants.SUBJECT, subject); entry.addProperty(Constants.HAS_THE_WORD, hasTheWord); entry.addProperty(Constants.DOESNT_HAVE_THE_WORD, doesNotHaveTheWord); entry.addProperty(Constants.HAS_ATTACHMENT, String.valueOf(hasAttachment)); entry.addProperty(Constants.SHOULD_MARK_AS_READ, String.valueOf(shouldMarkAsRead)); entry.addProperty(Constants.SHOULD_ARCHIVE, String.valueOf(shouldArchive)); entry.addProperty(Constants.LABEL, label); entry.addProperty(Constants.FORWARD_TO, forwardTo); entry.addProperty(Constants.NEVER_SPAM, String.valueOf(neverSpam)); entry.addProperty(Constants.SHOULD_STAR, String.valueOf(shouldStar)); entry.addProperty(Constants.SHOULD_TRASH, String.valueOf(shouldTrash)); for (String user : users) { logger.log(Level.INFO, "Creating filter ( " + "from: " + from + ", to: " + to + ", subject: " + subject + ", hasTheWord: " + hasTheWord + ", doesNotHaveTheWord: " + doesNotHaveTheWord + ", hasAttachment: " + hasAttachment + ", shouldMarkAsRead: " + shouldMarkAsRead + ", shouldArchive: " + shouldArchive + ", label: " + label + ", forwardTo: " + forwardTo + ", neverSpam: " + neverSpam + ", shouldStar: " + shouldStar + ", shouldTrash: " + shouldTrash + " ) for user " + user + " ..."); insertSettings(user, entry, "filter"); logger.log(Level.INFO, "Successfully created filter."); } }
void function(List<String> users, String from, String to, String subject, String hasTheWord, String doesNotHaveTheWord, boolean hasAttachment, boolean shouldMarkAsRead, boolean shouldArchive, String label, String forwardTo, boolean neverSpam, boolean shouldStar, boolean shouldTrash) throws IllegalArgumentException, ServiceException, MalformedURLException, IOException { if (users.size() == 0) { throw new IllegalArgumentException(); } GenericEntry entry = new GenericEntry(); entry.addProperty(Constants.FROM, from); entry.addProperty(Constants.TO, to); entry.addProperty(Constants.SUBJECT, subject); entry.addProperty(Constants.HAS_THE_WORD, hasTheWord); entry.addProperty(Constants.DOESNT_HAVE_THE_WORD, doesNotHaveTheWord); entry.addProperty(Constants.HAS_ATTACHMENT, String.valueOf(hasAttachment)); entry.addProperty(Constants.SHOULD_MARK_AS_READ, String.valueOf(shouldMarkAsRead)); entry.addProperty(Constants.SHOULD_ARCHIVE, String.valueOf(shouldArchive)); entry.addProperty(Constants.LABEL, label); entry.addProperty(Constants.FORWARD_TO, forwardTo); entry.addProperty(Constants.NEVER_SPAM, String.valueOf(neverSpam)); entry.addProperty(Constants.SHOULD_STAR, String.valueOf(shouldStar)); entry.addProperty(Constants.SHOULD_TRASH, String.valueOf(shouldTrash)); for (String user : users) { logger.log(Level.INFO, STR + STR + from + STR + to + STR + subject + STR + hasTheWord + STR + doesNotHaveTheWord + STR + hasAttachment + STR + shouldMarkAsRead + STR + shouldArchive + STR + label + STR + forwardTo + STR + neverSpam + STR + shouldStar + STR + shouldTrash + STR + user + STR); insertSettings(user, entry, STR); logger.log(Level.INFO, STR); } }
/** * Creates a filter. * * @param users a list of the users to create the filter for. * @param from the email must come from this address in order to be filtered. * @param to the email must be sent to this address in order to be filtered. * @param subject a string the email must have in it's subject line to be * filtered. * @param hasTheWord a string the email can have anywhere in it's subject or * body. * @param doesNotHaveTheWord a string that the email cannot have anywhere in * its subject or body. * @param hasAttachment a boolean representing whether or not the email * contains an attachment. Values are "true" or "false". * @param shouldMarkAsRead a boolean field that represents automatically * moving the message to. "Archived" state if it matches the specified * filter criteria. * @param shouldArchive a boolean field that represents automatically moving * the message to. "Archived" state if it matches the specified filter * criteria. * @param label a string that represents the name of the label to apply if a * message matches the specified filter criteria. * @param forwardTo a boolean representing whether to automatically forward * the message to the given verified email address if it matches the * filter criteria. * @param neverSpam a boolean representing whether the message satisfying the * filter criteria should never be marked as spam. * @param shouldStar a boolean representing whether to automatically star the * message if it matches the specified filter criteria. * @param shouldTrash a boolean representing whether to automatically move the * message to "Trash" state if it matches the specified filter criteria. * @throws IllegalArgumentException if no users are passed in. * @throws IOException if an error occurs while communicating with the GData * service. * @throws MalformedURLException if the batch feed URL cannot be constructed. * @throws ServiceException if the insert request failed due to system error. */
Creates a filter
createFilter
{ "repo_name": "simonrrr/gdata-java-client", "path": "java/sample/appsforyourdomain/gmailsettings/GmailSettingsService.java", "license": "apache-2.0", "size": 38761 }
[ "com.google.gdata.data.appsforyourdomain.generic.GenericEntry", "com.google.gdata.util.ServiceException", "java.io.IOException", "java.net.MalformedURLException", "java.util.List", "java.util.logging.Level" ]
import com.google.gdata.data.appsforyourdomain.generic.GenericEntry; import com.google.gdata.util.ServiceException; import java.io.IOException; import java.net.MalformedURLException; import java.util.List; import java.util.logging.Level;
import com.google.gdata.data.appsforyourdomain.generic.*; import com.google.gdata.util.*; import java.io.*; import java.net.*; import java.util.*; import java.util.logging.*;
[ "com.google.gdata", "java.io", "java.net", "java.util" ]
com.google.gdata; java.io; java.net; java.util;
2,418,645
@Override public boolean isSupported() { if (!(content instanceof AbstractFile)) { return false; } String detectedType = ((AbstractFile) content).getMIMEType(); if (detectedType == null || BINARY_MIME_TYPES.contains(detectedType) //any binary unstructured blobs (string extraction will be used) || ARCHIVE_MIME_TYPES.contains(detectedType) || (detectedType.startsWith("video/") && !detectedType.equals("video/x-flv")) //skip video other than flv (tika supports flv only) //NON-NLS || detectedType.equals(SQLITE_MIMETYPE) //Skip sqlite files, Tika cannot handle virtual tables and will fail with an exception. //NON-NLS ) { return false; } return TIKA_SUPPORTED_TYPES.contains(detectedType); }
boolean function() { if (!(content instanceof AbstractFile)) { return false; } String detectedType = ((AbstractFile) content).getMIMEType(); if (detectedType == null BINARY_MIME_TYPES.contains(detectedType) ARCHIVE_MIME_TYPES.contains(detectedType) (detectedType.startsWith(STR) && !detectedType.equals(STR)) detectedType.equals(SQLITE_MIMETYPE) ) { return false; } return TIKA_SUPPORTED_TYPES.contains(detectedType); }
/** * Determines if Tika is enabled for this content * * @return Flag indicating support for reading content type */
Determines if Tika is enabled for this content
isSupported
{ "repo_name": "sleuthkit/autopsy", "path": "Core/src/org/sleuthkit/autopsy/textextractors/TikaTextExtractor.java", "license": "apache-2.0", "size": 25298 }
[ "org.sleuthkit.datamodel.AbstractFile" ]
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.*;
[ "org.sleuthkit.datamodel" ]
org.sleuthkit.datamodel;
995,165
return new TestSuite(PlotRenderingInfoTests.class); } public PlotRenderingInfoTests(String name) { super(name); }
return new TestSuite(PlotRenderingInfoTests.class); } public PlotRenderingInfoTests(String name) { super(name); }
/** * Returns the tests as a test suite. * * @return The test suite. */
Returns the tests as a test suite
suite
{ "repo_name": "JSansalone/JFreeChart", "path": "tests/org/jfree/chart/plot/junit/PlotRenderingInfoTests.java", "license": "lgpl-2.1", "size": 5305 }
[ "junit.framework.TestSuite" ]
import junit.framework.TestSuite;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
407,014
MultiResponse execute() throws IOException; /** * Start executing the call and return a {@linkplain Interactor} * <p> * For more details on usage, see {@link Interactor}
MultiResponse execute() throws IOException; /** * Start executing the call and return a {@linkplain Interactor} * <p> * For more details on usage, see {@link Interactor}
/** * Executes the calls on the same thread and blocks it until the operation is complete or an exception is thrown. * * @return A reference to the {@linkplain MultiResponse} of this call * @throws IOException On failed IO operations */
Executes the calls on the same thread and blocks it until the operation is complete or an exception is thrown
execute
{ "repo_name": "pCloud/pcloud-networking-java", "path": "binapi-client/src/main/java/com/pcloud/networking/client/MultiCall.java", "license": "apache-2.0", "size": 4956 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,092,959
@SuppressWarnings("unchecked") private void executeGetBannerListByCampaignIdWithError(Object[] params, String errorMsg) throws MalformedURLException { try { @SuppressWarnings("unused") List<Map<String, Object>> result = (List<Map<String, Object>>) execute( GET_BANNER_LIST_BY_CAMPAIGN_ID_METHOD, params); fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE); } catch (XmlRpcException e) { assertEquals(ErrorMessage.WRONG_ERROR_MESSAGE, errorMsg, e .getMessage()); } }
@SuppressWarnings(STR) void function(Object[] params, String errorMsg) throws MalformedURLException { try { @SuppressWarnings(STR) List<Map<String, Object>> result = (List<Map<String, Object>>) execute( GET_BANNER_LIST_BY_CAMPAIGN_ID_METHOD, params); fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE); } catch (XmlRpcException e) { assertEquals(ErrorMessage.WRONG_ERROR_MESSAGE, errorMsg, e .getMessage()); } }
/** * Execute test method with error * * @param params - * parameters for test method * @param errorMsg - * true error messages * @throws MalformedURLException */
Execute test method with error
executeGetBannerListByCampaignIdWithError
{ "repo_name": "Mordred/revive-adserver", "path": "www/api/v2/xmlrpc/tests/unit/src/test/java/org/openx/banner/TestGetBannerListByCampaignId.java", "license": "gpl-2.0", "size": 4818 }
[ "java.net.MalformedURLException", "java.util.List", "java.util.Map", "org.apache.xmlrpc.XmlRpcException", "org.openx.utils.ErrorMessage" ]
import java.net.MalformedURLException; import java.util.List; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; import org.openx.utils.ErrorMessage;
import java.net.*; import java.util.*; import org.apache.xmlrpc.*; import org.openx.utils.*;
[ "java.net", "java.util", "org.apache.xmlrpc", "org.openx.utils" ]
java.net; java.util; org.apache.xmlrpc; org.openx.utils;
2,583,874
@Override public void render(int depth) { if (((depth < 0) && (Math.abs(depth) >= this.depth)) || depth == this.depth) { if (depth < 0) { GLContext.getCurrent().getGL().getGL2().glColor4f(1f, 0f, 0f, 1f); } bbox.render(); } }
void function(int depth) { if (((depth < 0) && (Math.abs(depth) >= this.depth)) depth == this.depth) { if (depth < 0) { GLContext.getCurrent().getGL().getGL2().glColor4f(1f, 0f, 0f, 1f); } bbox.render(); } }
/** * Draw the edges of the bounding box for this leaf if it is at depth * a_depth. */
Draw the edges of the bounding box for this leaf if it is at depth a_depth
render
{ "repo_name": "jchai3d/jchai3d", "path": "src/main/java/org/jchai3d/collisions/aabb/JCollisionAABBLeaf.java", "license": "gpl-2.0", "size": 4996 }
[ "com.jogamp.opengl.GLContext" ]
import com.jogamp.opengl.GLContext;
import com.jogamp.opengl.*;
[ "com.jogamp.opengl" ]
com.jogamp.opengl;
1,385,747
private DependencyListNode internal_addNode( IFile file ) { // don't add a file more than 1 time if( list_.containsKey( file.getProjectRelativePath( ).toString( ) ) ) { return getNode( file ); } DependencyListNode newNode = new DependencyListNode( file, - 1 ); if( previous_ != null ) { // inserting is done between 2 nodes if( previous_.getNext( ) != null ) { int newIndex = ( previous_.getIndex( ) + previous_.getNext( ) .getIndex( ) ) / 2; if( newIndex > previous_.getIndex( ) + DependencyListNode.INDEX_STEP ) { newIndex = previous_.getIndex( ) + DependencyListNode.INDEX_STEP; } newNode.setIndex( newIndex ); newNode.setNext( previous_.getNext( ) ); previous_.getNext( ).setPrevious( newNode ); } else { newNode.setIndex( currentIndex_ ); currentIndex_ += DependencyListNode.INDEX_STEP; } previous_.setNext( newNode ); newNode.setPrevious( previous_ ); } else { // no previous yet (== null) // so we're making this the root node for this list // check if we had a previous root node DependencyListNode root = list_.get( ROOT_NODE_KEY ); if( root != null ) { root.setPrevious( newNode ); newNode.setNext( root ); newNode.setIndex( root.getIndex( ) - DependencyListNode.INDEX_STEP ); } else { newNode.setIndex( currentIndex_ ); currentIndex_ += DependencyListNode.INDEX_STEP; } list_.put( ROOT_NODE_KEY, newNode ); } list_.put( file.getProjectRelativePath( ).toString( ), newNode ); previous_ = newNode; return newNode; }
DependencyListNode function( IFile file ) { if( list_.containsKey( file.getProjectRelativePath( ).toString( ) ) ) { return getNode( file ); } DependencyListNode newNode = new DependencyListNode( file, - 1 ); if( previous_ != null ) { if( previous_.getNext( ) != null ) { int newIndex = ( previous_.getIndex( ) + previous_.getNext( ) .getIndex( ) ) / 2; if( newIndex > previous_.getIndex( ) + DependencyListNode.INDEX_STEP ) { newIndex = previous_.getIndex( ) + DependencyListNode.INDEX_STEP; } newNode.setIndex( newIndex ); newNode.setNext( previous_.getNext( ) ); previous_.getNext( ).setPrevious( newNode ); } else { newNode.setIndex( currentIndex_ ); currentIndex_ += DependencyListNode.INDEX_STEP; } previous_.setNext( newNode ); newNode.setPrevious( previous_ ); } else { DependencyListNode root = list_.get( ROOT_NODE_KEY ); if( root != null ) { root.setPrevious( newNode ); newNode.setNext( root ); newNode.setIndex( root.getIndex( ) - DependencyListNode.INDEX_STEP ); } else { newNode.setIndex( currentIndex_ ); currentIndex_ += DependencyListNode.INDEX_STEP; } list_.put( ROOT_NODE_KEY, newNode ); } list_.put( file.getProjectRelativePath( ).toString( ), newNode ); previous_ = newNode; return newNode; }
/** * Adds a new node to this list * * @param file * The file to add * @return The newly created node */
Adds a new node to this list
internal_addNode
{ "repo_name": "drunklurker/wesnoth", "path": "utils/umc_dev/org.wesnoth/src/org/wesnoth/builder/DependencyListBuilder.java", "license": "gpl-2.0", "size": 32653 }
[ "org.eclipse.core.resources.IFile" ]
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.*;
[ "org.eclipse.core" ]
org.eclipse.core;
299,227
EAttribute getAbstractReferenceBaseType_Role();
EAttribute getAbstractReferenceBaseType_Role();
/** * Returns the meta object for the attribute '{@link net.opengis.ows11.AbstractReferenceBaseType#getRole <em>Role</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Role</em>'. * @see net.opengis.ows11.AbstractReferenceBaseType#getRole() * @see #getAbstractReferenceBaseType() * @generated */
Returns the meta object for the attribute '<code>net.opengis.ows11.AbstractReferenceBaseType#getRole Role</code>'.
getAbstractReferenceBaseType_Role
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.ows/src/net/opengis/ows11/Ows11Package.java", "license": "lgpl-2.1", "size": 292282 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,256,772
public void insertUpdate(DocumentEvent e) { if (!dirty) { setDirty(true); } }
void function(DocumentEvent e) { if (!dirty) { setDirty(true); } }
/** * Callback for when text is inserted into the document. * * @param e * Information on the insertion. */
Callback for when text is inserted into the document
insertUpdate
{ "repo_name": "kevinmcgoldrick/Tank", "path": "tools/script_filter/src/main/java/org/fife/ui/rsyntaxtextarea/TextEditorPane.java", "license": "epl-1.0", "size": 23922 }
[ "javax.swing.event.DocumentEvent" ]
import javax.swing.event.DocumentEvent;
import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
1,292,007
super.onCreate(savedInstanceState); // get specific layout for content view setContentView(R.layout.activity_edit_label); // add listeners to buttons buttonSave = (Button) findViewById(R.id.button_save); buttonSave.setOnClickListener(this); // open data source handle LabelsDataSource lds = new LabelsDataSource(this); long labelId = getIntent().getExtras().getLong("list_id"); editLabel = lds.getLabel(labelId); lds.close(); // fill in form data EditText labelNameText = (EditText) findViewById(R.id.edittext_label_name); labelNameText.setText(editLabel.getName()); EditText labelColorText = (EditText) findViewById(R.id.edittext_label_color); labelColorText.setText(editLabel.getColor()); }
super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_label); buttonSave = (Button) findViewById(R.id.button_save); buttonSave.setOnClickListener(this); LabelsDataSource lds = new LabelsDataSource(this); long labelId = getIntent().getExtras().getLong(STR); editLabel = lds.getLabel(labelId); lds.close(); EditText labelNameText = (EditText) findViewById(R.id.edittext_label_name); labelNameText.setText(editLabel.getName()); EditText labelColorText = (EditText) findViewById(R.id.edittext_label_color); labelColorText.setText(editLabel.getColor()); }
/** * onCreate override that provides label creation view to user . * * @param savedInstanceState Current application state data. */
onCreate override that provides label creation view to user
onCreate
{ "repo_name": "datanets/kanjoto", "path": "kanjoto-android/src/summea/kanjoto/activity/EditLabelActivity.java", "license": "mit", "size": 4060 }
[ "android.widget.Button", "android.widget.EditText" ]
import android.widget.Button; import android.widget.EditText;
import android.widget.*;
[ "android.widget" ]
android.widget;
464,620
private void getProjectsList(Composite groupContent){ list = new List(groupContent, SWT.BORDER | SWT.V_SCROLL); //find projects final Collection<String> projectNameList = new ArrayList<String>(); Collection<ICProject> cProjects = getCProjects(); for (ICProject cProject : cProjects){ projectNameList.add(cProject.getProject().getName()); } list.setItems(projectNameList.toArray(new String[projectNameList.size()])); list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }
void function(Composite groupContent){ list = new List(groupContent, SWT.BORDER SWT.V_SCROLL); final Collection<String> projectNameList = new ArrayList<String>(); Collection<ICProject> cProjects = getCProjects(); for (ICProject cProject : cProjects){ projectNameList.add(cProject.getProject().getName()); } list.setItems(projectNameList.toArray(new String[projectNameList.size()])); list.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); }
/** * Get a list of C projects * @param groupContent */
Get a list of C projects
getProjectsList
{ "repo_name": "gerasimou/EMC-CDT", "path": "org.eclipse.epsilon.emc.cdt.dt/src/org/eclipse/epsilon/emc/cdt/dt/CdtModelConfigurationDialog.java", "license": "epl-1.0", "size": 5486 }
[ "java.util.ArrayList", "java.util.Collection", "org.eclipse.cdt.core.model.ICProject", "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.List" ]
import java.util.ArrayList; import java.util.Collection; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.List;
import java.util.*; import org.eclipse.cdt.core.model.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
[ "java.util", "org.eclipse.cdt", "org.eclipse.swt" ]
java.util; org.eclipse.cdt; org.eclipse.swt;
1,225,510
@Override public final double derivativeFunction(final double b, final double a) { throw new EncogError("Can't use the competitive activation function " + "where a derivative is required."); }
final double function(final double b, final double a) { throw new EncogError(STR + STR); }
/** * Implements the activation function. The array is modified according to * the activation function being used. See the class description for more * specific information on this type of activation function. * * @param d * The input array to the activation function. * @return The derivative. */
Implements the activation function. The array is modified according to the activation function being used. See the class description for more specific information on this type of activation function
derivativeFunction
{ "repo_name": "larhoy/SentimentProjectV2", "path": "SentimentAnalysisV2/encog-core-3.1.0/src/main/java/org/encog/engine/network/activation/ActivationCompetitive.java", "license": "mit", "size": 4416 }
[ "org.encog.EncogError" ]
import org.encog.EncogError;
import org.encog.*;
[ "org.encog" ]
org.encog;
991,439
public Diagram getAssociatedGMFDiagram() { return this.gmfDiagram; }
Diagram function() { return this.gmfDiagram; }
/** * Get the GMF Diagram associated to the Sirius diagram. * * @return the associated GMF diagram to the Sirius one. */
Get the GMF Diagram associated to the Sirius diagram
getAssociatedGMFDiagram
{ "repo_name": "FTSRG/iq-sirius-integration", "path": "host/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/api/refresh/DiagramCreationUtil.java", "license": "epl-1.0", "size": 3287 }
[ "org.eclipse.gmf.runtime.notation.Diagram" ]
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.*;
[ "org.eclipse.gmf" ]
org.eclipse.gmf;
1,266,470
private void makeWheel() { holes = new Dot[numHoles]; numbers = new Text[numHoles]; double delta = 2.0*Math.PI/numHoles; // radians per hole double ph = phase * delta; // additional phase shift (radians) // arrow on left side arrow.moveTo(new Point2D.Double((-WHEEL_RADIUS)*Math.cos(-ph), (WHEEL_RADIUS)*Math.sin(-ph))); double angle; // in radians for (int i = 0; i < holes.length; i++) { angle = (double)i * delta - Math.toRadians(rotation); // holes on left side holes[i] = new Dot(new Point2D.Double(-HOLES_RADIUS*Math.cos(angle), HOLES_RADIUS*Math.sin(angle))); holes[i].setFill(false); numbers[i] = new Text(new Point2D.Double(-TEXT_RADIUS*Math.cos(angle), TEXT_RADIUS*Math.sin(angle)), Integer.toString(i)); numbers[i].setFont(NUMBER_FONT); } }
void function() { holes = new Dot[numHoles]; numbers = new Text[numHoles]; double delta = 2.0*Math.PI/numHoles; double ph = phase * delta; arrow.moveTo(new Point2D.Double((-WHEEL_RADIUS)*Math.cos(-ph), (WHEEL_RADIUS)*Math.sin(-ph))); double angle; for (int i = 0; i < holes.length; i++) { angle = (double)i * delta - Math.toRadians(rotation); holes[i] = new Dot(new Point2D.Double(-HOLES_RADIUS*Math.cos(angle), HOLES_RADIUS*Math.sin(angle))); holes[i].setFill(false); numbers[i] = new Text(new Point2D.Double(-TEXT_RADIUS*Math.cos(angle), TEXT_RADIUS*Math.sin(angle)), Integer.toString(i)); numbers[i].setFont(NUMBER_FONT); } }
/** * Make all the features of the wheel. * (the first time, or when the number of holes changes). * All holes are un-filled. */
Make all the features of the wheel. (the first time, or when the number of holes changes). All holes are un-filled
makeWheel
{ "repo_name": "billooms/Indexer", "path": "IndexWheel/src/com/billooms/indexwheel/IndexWheelImpl.java", "license": "gpl-3.0", "size": 15139 }
[ "com.billooms.indexwheel.drawables.Dot", "com.billooms.indexwheel.drawables.Text", "java.awt.geom.Point2D" ]
import com.billooms.indexwheel.drawables.Dot; import com.billooms.indexwheel.drawables.Text; import java.awt.geom.Point2D;
import com.billooms.indexwheel.drawables.*; import java.awt.geom.*;
[ "com.billooms.indexwheel", "java.awt" ]
com.billooms.indexwheel; java.awt;
1,601,808
public Observable<ServiceResponse<Page<NamespaceResourceInner>>> listAllNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<NamespaceResourceInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Lists all the available namespaces within the subscription irrespective of the resourceGroups. * ServiceResponse<PageImpl<NamespaceResourceInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;NamespaceResourceInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Lists all the available namespaces within the subscription irrespective of the resourceGroups
listAllNextSinglePageAsync
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-notificationhubs/src/main/java/com/microsoft/azure/management/notificationhubs/implementation/NamespacesInner.java", "license": "mit", "size": 118543 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,079,488
public String getConfigFile() { String configFile = System.getProperty(configSystemProp); if (isBlank(configFile)) { configFile = System.getenv(configSystemEnv); } return defaultIfBlank(configFile, null); } String homeDir;
String function() { String configFile = System.getProperty(configSystemProp); if (isBlank(configFile)) { configFile = System.getenv(configSystemEnv); } return defaultIfBlank(configFile, null); } String homeDir;
/** * Configuration file from either {@code app.config} system property or * {@code APP_CONFIG}. * * If not set then {@code null} is returned. * * @return Application configuration file or {@code null} if not defined. */
Configuration file from either app.config system property or APP_CONFIG. If not set then null is returned
getConfigFile
{ "repo_name": "brettryan/spring-app-base", "path": "src/main/java/com/drunkendev/web/settings/AppConfig.java", "license": "apache-2.0", "size": 10247 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
487,952
public Set<InternalDistributedMember> getMembers() { return this.serverFilterInfo.keySet(); }
Set<InternalDistributedMember> function() { return this.serverFilterInfo.keySet(); }
/** * Returns the members list that has filters satisfied. * * @return the members who have filter routing information */
Returns the members list that has filters satisfied
getMembers
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/FilterRoutingInfo.java", "license": "apache-2.0", "size": 19265 }
[ "java.util.Set", "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import java.util.Set; import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import java.util.*; import org.apache.geode.distributed.internal.membership.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
891,259
public EducationSubtype update(EducationSubtype educationSubtype, String name, String code) { EntityManager entityManager = getEntityManager(); educationSubtype.setName(name); educationSubtype.setCode(code); entityManager.persist(educationSubtype); return educationSubtype; }
EducationSubtype function(EducationSubtype educationSubtype, String name, String code) { EntityManager entityManager = getEntityManager(); educationSubtype.setName(name); educationSubtype.setCode(code); entityManager.persist(educationSubtype); return educationSubtype; }
/** * Updates the given education subtype with the given data. * * @param educationSubtype * The education subtype to be updated * @param name * The education subtype name * @return */
Updates the given education subtype with the given data
update
{ "repo_name": "leafsoftinfo/pyramus", "path": "persistence/src/main/java/fi/pyramus/dao/base/EducationSubtypeDAO.java", "license": "gpl-3.0", "size": 3647 }
[ "fi.pyramus.domainmodel.base.EducationSubtype", "javax.persistence.EntityManager" ]
import fi.pyramus.domainmodel.base.EducationSubtype; import javax.persistence.EntityManager;
import fi.pyramus.domainmodel.base.*; import javax.persistence.*;
[ "fi.pyramus.domainmodel", "javax.persistence" ]
fi.pyramus.domainmodel; javax.persistence;
1,460,381
protected double[] calculateMeanCounts(Collection<HasGraphletSignature> signatures) { double[] results = new double[GraphletCounter.NUM_ORBITS]; for (Iterator<HasGraphletSignature> iterator = signatures.iterator(); iterator.hasNext();) { int[] counts = iterator.next().getCounts(); for (int i = 0; i < counts.length; i++) { results[i] += counts[i]; } } for (int i = 0; i < results.length; i++) { results[i] /= signatures.size(); } return results; }
double[] function(Collection<HasGraphletSignature> signatures) { double[] results = new double[GraphletCounter.NUM_ORBITS]; for (Iterator<HasGraphletSignature> iterator = signatures.iterator(); iterator.hasNext();) { int[] counts = iterator.next().getCounts(); for (int i = 0; i < counts.length; i++) { results[i] += counts[i]; } } for (int i = 0; i < results.length; i++) { results[i] /= signatures.size(); } return results; }
/** * Given the computes list of counts by nodes, calcualtes the mean count for each automorphism orbit * and returns the results. * @param signatures * @return */
Given the computes list of counts by nodes, calcualtes the mean count for each automorphism orbit and returns the results
calculateMeanCounts
{ "repo_name": "falk/graphletcounter", "path": "src/main/java/edu/ohsu/graphlet/cytoscape/GraphletCountTask.java", "license": "lgpl-3.0", "size": 2039 }
[ "edu.ohsu.graphlet.core.GraphletCounter", "edu.ohsu.graphlet.core.HasGraphletSignature", "java.util.Collection", "java.util.Iterator" ]
import edu.ohsu.graphlet.core.GraphletCounter; import edu.ohsu.graphlet.core.HasGraphletSignature; import java.util.Collection; import java.util.Iterator;
import edu.ohsu.graphlet.core.*; import java.util.*;
[ "edu.ohsu.graphlet", "java.util" ]
edu.ohsu.graphlet; java.util;
2,113,007
public static String loadFile(String fileName) { StringBuffer data = new StringBuffer(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(DIRECTORY + fileName))); String input = br.readLine(); while (input != null) { if (!input.equals("")) data.append(input + "\n"); input = br.readLine(); } } catch (IOException ioe) { ioe.printStackTrace(); } return data.toString(); }
static String function(String fileName) { StringBuffer data = new StringBuffer(); try { br = new BufferedReader(new InputStreamReader(new FileInputStream(DIRECTORY + fileName))); String input = br.readLine(); while (input != null) { if (!input.equals(STR\n"); input = br.readLine(); } } catch (IOException ioe) { ioe.printStackTrace(); } return data.toString(); }
/** * Loads data from a file as specified by the file name supplied. * * @param fileName * the file to be loaded * @return the data contained in the file specified */
Loads data from a file as specified by the file name supplied
loadFile
{ "repo_name": "lrusnac/maig-2016", "path": "src/pacman/game/util/IO.java", "license": "gpl-3.0", "size": 2822 }
[ "java.io.BufferedReader", "java.io.FileInputStream", "java.io.IOException", "java.io.InputStreamReader" ]
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader;
import java.io.*;
[ "java.io" ]
java.io;
334,177
private JPanel getTypePolygonBufferPanel() { if (typePolygonBufferPanel == null) { typeBufferLabel = new JLabel(); typeBufferLabel.setBounds(new java.awt.Rectangle(10, 3, 143, 18)); typeBufferLabel.setText(PluginServices .getText(this, "Crear_Buffer")); typePolygonBufferPanel = new JPanel(); typePolygonBufferPanel.setLayout(null); typePolygonBufferPanel.setBounds(new java.awt.Rectangle(8, 6, 449, 24)); typePolygonBufferPanel.add(typeBufferLabel, null); typePolygonBufferPanel.add(getTypeBufferComboBox(), null); } return typePolygonBufferPanel; }
JPanel function() { if (typePolygonBufferPanel == null) { typeBufferLabel = new JLabel(); typeBufferLabel.setBounds(new java.awt.Rectangle(10, 3, 143, 18)); typeBufferLabel.setText(PluginServices .getText(this, STR)); typePolygonBufferPanel = new JPanel(); typePolygonBufferPanel.setLayout(null); typePolygonBufferPanel.setBounds(new java.awt.Rectangle(8, 6, 449, 24)); typePolygonBufferPanel.add(typeBufferLabel, null); typePolygonBufferPanel.add(getTypeBufferComboBox(), null); } return typePolygonBufferPanel; }
/** * This method initializes typePolygonBufferPanel * * @return javax.swing.JPanel */
This method initializes typePolygonBufferPanel
getTypePolygonBufferPanel
{ "repo_name": "iCarto/siga", "path": "extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/impl/buffer/gui/GeoProcessingBufferPanel.java", "license": "gpl-3.0", "size": 21001 }
[ "com.iver.andami.PluginServices", "javax.swing.JLabel", "javax.swing.JPanel" ]
import com.iver.andami.PluginServices; import javax.swing.JLabel; import javax.swing.JPanel;
import com.iver.andami.*; import javax.swing.*;
[ "com.iver.andami", "javax.swing" ]
com.iver.andami; javax.swing;
1,537,973
@Override public Document createDocument(Object... keyValuePairs) { // TODO Auto-generated method stub return null; }
Document function(Object... keyValuePairs) { return null; }
/** * Not implemented yet. */
Not implemented yet
createDocument
{ "repo_name": "hyarthi/project-red", "path": "src/java/org.openntf.red.main/src/org/openntf/red/impl/Database.java", "license": "apache-2.0", "size": 36930 }
[ "org.openntf.red.Document" ]
import org.openntf.red.Document;
import org.openntf.red.*;
[ "org.openntf.red" ]
org.openntf.red;
2,729,975
public void testInputStream() throws RepositoryException { InputStreamWrapper in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue)); valueFactory.createValue(in); assertTrue("ValueFactory.createValue(InputStream) is expected to close the passed input stream", in.isClosed()); in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue)); Binary bin = valueFactory.createBinary(in); assertTrue("ValueFactory.createBinary(InputStream) is expected to close the passed input stream", in.isClosed()); bin.dispose(); }
void function() throws RepositoryException { InputStreamWrapper in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue)); valueFactory.createValue(in); assertTrue(STR, in.isClosed()); in = new InputStreamWrapper(new ByteArrayInputStream(binaryValue)); Binary bin = valueFactory.createBinary(in); assertTrue(STR, in.isClosed()); bin.dispose(); }
/** * Tests whether a passed <code>InputStream</code> is closed * by the implementation. * * @throws RepositoryException */
Tests whether a passed <code>InputStream</code> is closed by the implementation
testInputStream
{ "repo_name": "apache/jackrabbit", "path": "jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java", "license": "apache-2.0", "size": 13805 }
[ "java.io.ByteArrayInputStream", "javax.jcr.Binary", "javax.jcr.RepositoryException", "org.apache.jackrabbit.test.api.util.InputStreamWrapper" ]
import java.io.ByteArrayInputStream; import javax.jcr.Binary; import javax.jcr.RepositoryException; import org.apache.jackrabbit.test.api.util.InputStreamWrapper;
import java.io.*; import javax.jcr.*; import org.apache.jackrabbit.test.api.util.*;
[ "java.io", "javax.jcr", "org.apache.jackrabbit" ]
java.io; javax.jcr; org.apache.jackrabbit;
639,919
public static Object createDefaultLocations(String rootDirStr, String serverName, Map<String, Object> map, boolean isClient) { if (rootDirStr == null || rootDirStr.length() <= 0) throw new IllegalArgumentException("createDefaultLocations must be called with a non-null/non-empty string specifying the root directory"); File root = new File(rootDirStr); if (root == null || !root.exists()) throw new IllegalArgumentException("createDefaultLocations must be called with an existing root directory"); File lib = new File(root, "lib"); File usr = new File(root, "usr"); lib.mkdir(); usr.mkdir(); if (map == null) map = new HashMap<String, Object>(); if (serverName == null) serverName = "defaultServer"; map.put("wlp.user.dir", usr.getAbsolutePath() + '/'); map.put("wlp.lib.dir", lib.getAbsolutePath() + '/'); map.put("wlp.server.name", serverName); // Defined in BootstrapConstants.PROCESS_TYPE_CLIENT // Defined in BootstrapConstants.PROCESS_TYPE_SERVER map.put("wlp.process.type", isClient ? "client" : "server"); map.put("wlp.svc.binding.root", usr.getAbsolutePath() + File.separator + "bindings"); Class<?> impl = getLocServiceImpl(); resetWsLocationAdmin(); Method m; try { m = impl.getDeclaredMethod("createLocations", Map.class); m.setAccessible(true); m.invoke(null, map); } catch (InvocationTargetException ite) { System.err.println("Woops! Something is amiss-- could not configure test locations"); Throwable cause = ite.getCause(); cause.printStackTrace(); throw new java.lang.InstantiationError("Unable to configure test locations"); } catch (Exception e) { System.err.println("Woops! Something is amiss-- could not configure test locations"); e.printStackTrace(); throw new java.lang.InstantiationError("Unable to configure test locations"); } return getLocationInstance(); }
static Object function(String rootDirStr, String serverName, Map<String, Object> map, boolean isClient) { if (rootDirStr == null rootDirStr.length() <= 0) throw new IllegalArgumentException(STR); File root = new File(rootDirStr); if (root == null !root.exists()) throw new IllegalArgumentException(STR); File lib = new File(root, "lib"); File usr = new File(root, "usr"); lib.mkdir(); usr.mkdir(); if (map == null) map = new HashMap<String, Object>(); if (serverName == null) serverName = STR; map.put(STR, usr.getAbsolutePath() + '/'); map.put(STR, lib.getAbsolutePath() + '/'); map.put(STR, serverName); map.put(STR, isClient ? STR : STR); map.put(STR, usr.getAbsolutePath() + File.separator + STR); Class<?> impl = getLocServiceImpl(); resetWsLocationAdmin(); Method m; try { m = impl.getDeclaredMethod(STR, Map.class); m.setAccessible(true); m.invoke(null, map); } catch (InvocationTargetException ite) { System.err.println(STR); Throwable cause = ite.getCause(); cause.printStackTrace(); throw new java.lang.InstantiationError(STR); } catch (Exception e) { System.err.println(STR); e.printStackTrace(); throw new java.lang.InstantiationError(STR); } return getLocationInstance(); }
/** * Used in test: construct and replace the singleton instance of the * WsLocationAdmin service/manager based on the provided root directory. This * will create a full replica of the default server install directory, * underneath the provided root directory (instead of wlp/). * <p> * Directories will not be accessed/created until requested. * * @param rootDirStr * Root directory for structure shown above * @param serverName * Name of server * @param map * String-to-Object map containing additional properties that should * be passed to the location service. The following properties are * set by this method (and will be overwritten): wlp.install.dir, * wlp.user.dir, wlp.lib.dir, wlp.server.name * @param isClient * boolean value to determine whether this call is used for client or server. * * @return the configured WsLocationAdmin instance. */
Used in test: construct and replace the singleton instance of the WsLocationAdmin service/manager based on the provided root directory. This will create a full replica of the default server install directory, underneath the provided root directory (instead of wlp/). Directories will not be accessed/created until requested
createDefaultLocations
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.junit.extensions/src/test/common/SharedLocationManager.java", "license": "epl-1.0", "size": 19185 }
[ "java.io.File", "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method", "java.util.HashMap", "java.util.Map" ]
import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map;
import java.io.*; import java.lang.reflect.*; import java.util.*;
[ "java.io", "java.lang", "java.util" ]
java.io; java.lang; java.util;
615,103
BufferedImage getIcon( String studyUID, String seriesUID, String instanceUID, String rows, String columns );
BufferedImage getIcon( String studyUID, String seriesUID, String instanceUID, String rows, String columns );
/** * Get an icon of special size from cache. * <p> * This method use a image size (rows and columns) to search on a special path of this cache. * * @param studyUID Unique identifier of the study. * @param seriesUID Unique identifier of the series. * @param instanceUID Unique identifier of the instance. * @param rows Image height in pixel. * @param columns Image width in pixel. * * @return The image if in cache or null. */
Get an icon of special size from cache. This method use a image size (rows and columns) to search on a special path of this cache
getIcon
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/tags/DCM4JBOSS_2_3/dcm4jboss-wado/src/java/org/dcm4chex/wado/mbean/cache/IconCache.java", "license": "apache-2.0", "size": 5048 }
[ "java.awt.image.BufferedImage" ]
import java.awt.image.BufferedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
1,178,093
protected void loadParse() { try { // Parse Models ParseObject.registerSubclass(Message.class); // Parse Local Data Store Parse.enableLocalDatastore(this); // Enable Local Storage Parse.enableLocalDatastore(this); // Initialize Parse Parse.initialize(this); } catch(Exception e) { Log.i(LOG, "error while setting up Parse :: " + e); } }
void function() { try { ParseObject.registerSubclass(Message.class); Parse.enableLocalDatastore(this); Parse.enableLocalDatastore(this); Parse.initialize(this); } catch(Exception e) { Log.i(LOG, STR + e); } }
/** * Load the Parse Library using the keys with the project registered at: * https://www.parse.com */
Load the Parse Library using the keys with the project registered at: HREF
loadParse
{ "repo_name": "dcf82/ParseChatApp", "path": "app/src/main/java/com/imagination/technologies/parse/chat/controller/ChatApplication.java", "license": "gpl-2.0", "size": 1083 }
[ "android.util.Log", "com.imagination.technologies.parse.chat.beans.Message", "com.parse.Parse", "com.parse.ParseObject" ]
import android.util.Log; import com.imagination.technologies.parse.chat.beans.Message; import com.parse.Parse; import com.parse.ParseObject;
import android.util.*; import com.imagination.technologies.parse.chat.beans.*; import com.parse.*;
[ "android.util", "com.imagination.technologies", "com.parse" ]
android.util; com.imagination.technologies; com.parse;
220,422
public void updateEnvironment(String category) { EnvironmentVarModel model = environmentVarSets.viewCategory(category); for (int row = 0; row < model.getRowCount(); row++) { EnvironmentVar entry = model.get(row); if (entry.getDefined()) { getEnvironmentMap().put(entry.getName(), entry.getValue().toString()); } else { getEnvironmentMap().remove(entry.getName()); } } }
void function(String category) { EnvironmentVarModel model = environmentVarSets.viewCategory(category); for (int row = 0; row < model.getRowCount(); row++) { EnvironmentVar entry = model.get(row); if (entry.getDefined()) { getEnvironmentMap().put(entry.getName(), entry.getValue().toString()); } else { getEnvironmentMap().remove(entry.getName()); } } }
/** * Updates the environment variables maintained in the category. * * @param category the category for which the values will be updated */
Updates the environment variables maintained in the category
updateEnvironment
{ "repo_name": "kingkybel/utilities", "path": "ProcessUtilities/src/com/kybelksties/process/ConcreteProcess.java", "license": "gpl-2.0", "size": 16777 }
[ "com.kybelksties.general.EnvironmentVar", "com.kybelksties.general.EnvironmentVarModel" ]
import com.kybelksties.general.EnvironmentVar; import com.kybelksties.general.EnvironmentVarModel;
import com.kybelksties.general.*;
[ "com.kybelksties.general" ]
com.kybelksties.general;
301,654
public Builder<TYPE> silentRuleClassFilter() { Preconditions.checkState((type == BuildType.LABEL) || (type == BuildType.LABEL_LIST), "must be a label-valued type"); return setPropertyFlag(PropertyFlag.SILENT_RULECLASS_FILTER, "silent_ruleclass_filter"); }
Builder<TYPE> function() { Preconditions.checkState((type == BuildType.LABEL) (type == BuildType.LABEL_LIST), STR); return setPropertyFlag(PropertyFlag.SILENT_RULECLASS_FILTER, STR); }
/** * Forces silent ruleclass filtering on the label type attribute. * This flag is introduced to handle plugins, do not use it in other cases. */
Forces silent ruleclass filtering on the label type attribute. This flag is introduced to handle plugins, do not use it in other cases
silentRuleClassFilter
{ "repo_name": "mikelalcon/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Attribute.java", "license": "apache-2.0", "size": 64223 }
[ "com.google.devtools.build.lib.util.Preconditions" ]
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.util.*;
[ "com.google.devtools" ]
com.google.devtools;
816,888
NativeDeploymentQuery createNativeDeploymentQuery();
NativeDeploymentQuery createNativeDeploymentQuery();
/** * Returns a new {@link org.activiti.engine.query.NativeQuery} for deployment. */
Returns a new <code>org.activiti.engine.query.NativeQuery</code> for deployment
createNativeDeploymentQuery
{ "repo_name": "motorina0/flowable-engine", "path": "modules/flowable5-engine/src/main/java/org/activiti/engine/RepositoryService.java", "license": "apache-2.0", "size": 19035 }
[ "org.activiti.engine.repository.NativeDeploymentQuery" ]
import org.activiti.engine.repository.NativeDeploymentQuery;
import org.activiti.engine.repository.*;
[ "org.activiti.engine" ]
org.activiti.engine;
1,701,689
public void write(OutputStream out) throws IOException { byte[] data = getData(); if(data != null) out.write(data); }
void function(OutputStream out) throws IOException { byte[] data = getData(); if(data != null) out.write(data); }
/** * Writes the metadata out to the output stream * * @param out OutputStream to write the metadata to * @throws IOException */
Writes the metadata out to the output stream
write
{ "repo_name": "dragon66/pixymeta-android", "path": "src/pixy/meta/Metadata.java", "license": "epl-1.0", "size": 19237 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,661,089
public void update (Set oldSet, Set newSet) { // Collect all simplices neighboring the oldSet Set allNeighbors = new HashSet(); for (Iterator it = oldSet.iterator(); it.hasNext();) allNeighbors.addAll((Set) neighbors.get((Simplex) it.next())); // Delete the oldSet for (Iterator it = oldSet.iterator(); it.hasNext();) { Simplex simplex = (Simplex) it.next(); for (Iterator otherIt = ((Set) neighbors.get(simplex)).iterator(); otherIt.hasNext();) ((Set) neighbors.get(otherIt.next())).remove(simplex); neighbors.remove(simplex); allNeighbors.remove(simplex); } // Include the newSet simplices as possible neighbors allNeighbors.addAll(newSet); // Create entries for the simplices in the newSet for (Iterator it = newSet.iterator(); it.hasNext();) neighbors.put((Simplex) it.next(), new HashSet()); // Update all the neighbors info for (Iterator it = newSet.iterator(); it.hasNext();) { Simplex s1 = (Simplex) it.next(); for (Iterator otherIt = allNeighbors.iterator(); otherIt.hasNext();) { Simplex s2 = (Simplex) otherIt.next(); if (!s1.isNeighbor(s2)) continue; ((Set) neighbors.get(s1)).add(s2); ((Set) neighbors.get(s2)).add(s1); } } }
void function (Set oldSet, Set newSet) { Set allNeighbors = new HashSet(); for (Iterator it = oldSet.iterator(); it.hasNext();) allNeighbors.addAll((Set) neighbors.get((Simplex) it.next())); for (Iterator it = oldSet.iterator(); it.hasNext();) { Simplex simplex = (Simplex) it.next(); for (Iterator otherIt = ((Set) neighbors.get(simplex)).iterator(); otherIt.hasNext();) ((Set) neighbors.get(otherIt.next())).remove(simplex); neighbors.remove(simplex); allNeighbors.remove(simplex); } allNeighbors.addAll(newSet); for (Iterator it = newSet.iterator(); it.hasNext();) neighbors.put((Simplex) it.next(), new HashSet()); for (Iterator it = newSet.iterator(); it.hasNext();) { Simplex s1 = (Simplex) it.next(); for (Iterator otherIt = allNeighbors.iterator(); otherIt.hasNext();) { Simplex s2 = (Simplex) otherIt.next(); if (!s1.isNeighbor(s2)) continue; ((Set) neighbors.get(s1)).add(s2); ((Set) neighbors.get(s2)).add(s1); } } }
/** * Update by replacing one set of Simplices with another. * Both sets of simplices must fill the same "hole" in the * Triangulation. * @param oldSet set of Simplices to be replaced * @param newSet set of replacement Simplices */
Update by replacing one set of Simplices with another. Both sets of simplices must fill the same "hole" in the Triangulation
update
{ "repo_name": "iCarto/siga", "path": "libFMap/src/com/iver/cit/gvsig/topology/triangulation/Triangulation.java", "license": "gpl-3.0", "size": 6528 }
[ "java.util.HashSet", "java.util.Iterator", "java.util.Set" ]
import java.util.HashSet; import java.util.Iterator; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
213,351
@Test public void testRelative8() throws Throwable { final String startPath = "/one/two"; final String targetPath = "/one/two-c/"; assertEquals("Relative path should retain trailing forward slash if it exists in Call", "two-c/", Paths.relative(startPath, targetPath)); }
void function() throws Throwable { final String startPath = STR; final String targetPath = STR; assertEquals(STR, STR, Paths.relative(startPath, targetPath)); }
/** * Current Path: /one/two/ * Target Path: /one/two-c/ * Relative Path: two-c/ */
Current Path: /one/two Target Path: /one/two-c Relative Path: two-c
testRelative8
{ "repo_name": "Shenker93/playframework", "path": "framework/src/play/src/test/java/play/core/PathsTest.java", "license": "apache-2.0", "size": 6223 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,203,806
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ManagedPrivateEndpoint> list(String managedVirtualNetworkName) { return this.serviceClient.list(managedVirtualNetworkName); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ManagedPrivateEndpoint> function(String managedVirtualNetworkName) { return this.serviceClient.list(managedVirtualNetworkName); }
/** * List Managed Private Endpoints. * * @param managedVirtualNetworkName Managed virtual network name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of managed private endpoints. */
List Managed Private Endpoints
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/synapse/azure-analytics-synapse-managedprivateendpoints/src/main/java/com/azure/analytics/synapse/managedprivateendpoints/ManagedPrivateEndpointsClient.java", "license": "mit", "size": 8067 }
[ "com.azure.analytics.synapse.managedprivateendpoints.models.ManagedPrivateEndpoint", "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable" ]
import com.azure.analytics.synapse.managedprivateendpoints.models.ManagedPrivateEndpoint; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable;
import com.azure.analytics.synapse.managedprivateendpoints.models.*; import com.azure.core.annotation.*; import com.azure.core.http.rest.*;
[ "com.azure.analytics", "com.azure.core" ]
com.azure.analytics; com.azure.core;
1,282,225
public synchronized boolean rotate(String newFileName) { if (currentLogFile != null) { File holder = currentLogFile; close(); try { holder.renameTo(new File(newFileName)); } catch (Throwable e) { log.error("rotate failed", e); } currentDate = new Date(System.currentTimeMillis()); dateStamp = fileDateFormatter.format(currentDate); open(); return true; } else { return false; } } // -------------------------------------------------------- Private Methods
synchronized boolean function(String newFileName) { if (currentLogFile != null) { File holder = currentLogFile; close(); try { holder.renameTo(new File(newFileName)); } catch (Throwable e) { log.error(STR, e); } currentDate = new Date(System.currentTimeMillis()); dateStamp = fileDateFormatter.format(currentDate); open(); return true; } else { return false; } }
/** * Rename the existing log file to something else. Then open the * old log file name up once again. Intended to be called by a JMX * agent. * * * @param newFileName The file name to move the log file entry to * @return true if a file was rotated with no error */
Rename the existing log file to something else. Then open the old log file name up once again. Intended to be called by a JMX agent
rotate
{ "repo_name": "Netprophets/JBOSSWEB_7_0_13_FINAL", "path": "java/org/apache/catalina/valves/AccessLogValve.java", "license": "lgpl-3.0", "size": 44088 }
[ "java.io.File", "java.util.Date" ]
import java.io.File; import java.util.Date;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
138,291
public void setUnmaximizeCommand(Command unmaximizeCommand) { this.unmaximizeCommand = unmaximizeCommand; }
void function(Command unmaximizeCommand) { this.unmaximizeCommand = unmaximizeCommand; }
/** * Sets the command to invoke upon each transition from maximized to unmaximized. */
Sets the command to invoke upon each transition from maximized to unmaximized
setUnmaximizeCommand
{ "repo_name": "ederign/uberfire", "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java", "license": "apache-2.0", "size": 4368 }
[ "org.uberfire.mvp.Command" ]
import org.uberfire.mvp.Command;
import org.uberfire.mvp.*;
[ "org.uberfire.mvp" ]
org.uberfire.mvp;
2,495,359
private boolean isNodeAtCurrentLexicalScope(Node n) { Node parent = n.getParent(); Preconditions.checkState(parent.isBlock() || parent.isFor() || parent.isForOf() || parent.isScript() || parent.isLabel()); if (parent == scope.getRootNode() || parent.isScript() || (parent.getParent().isCatch() && parent.getParent().getParent() == scope.getRootNode())) { return true; } while (parent.isLabel()) { if (parent.getParent() == scope.getRootNode()) { return true; } parent = parent.getParent(); } return false; }
boolean function(Node n) { Node parent = n.getParent(); Preconditions.checkState(parent.isBlock() parent.isFor() parent.isForOf() parent.isScript() parent.isLabel()); if (parent == scope.getRootNode() parent.isScript() (parent.getParent().isCatch() && parent.getParent().getParent() == scope.getRootNode())) { return true; } while (parent.isLabel()) { if (parent.getParent() == scope.getRootNode()) { return true; } parent = parent.getParent(); } return false; }
/** * Determines whether the name should be declared at current lexical scope. * Assume the parent node is a BLOCK, FOR, FOR_OF, SCRIPT or LABEL. * TODO(moz): Make sure this assumption holds. * * @param n The declaration node to be checked * @return whether the name should be declared at current lexical scope */
Determines whether the name should be declared at current lexical scope. Assume the parent node is a BLOCK, FOR, FOR_OF, SCRIPT or LABEL. TODO(moz): Make sure this assumption holds
isNodeAtCurrentLexicalScope
{ "repo_name": "robbert/closure-compiler", "path": "src/com/google/javascript/jscomp/Es6SyntacticScopeCreator.java", "license": "apache-2.0", "size": 9442 }
[ "com.google.common.base.Preconditions", "com.google.javascript.rhino.Node" ]
import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node;
import com.google.common.base.*; import com.google.javascript.rhino.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
1,981,221
CompletableFuture<Void> setTargetVerticalTiltAngle(int angle) throws Exception;
CompletableFuture<Void> setTargetVerticalTiltAngle(int angle) throws Exception;
/** * Sets the target position * * @param angle the target angle to set, as a value between -90 and 90 * @return a future that completes when the change is made * @throws Exception when the change cannot be made */
Sets the target position
setTargetVerticalTiltAngle
{ "repo_name": "beowulfe/HAP-Java", "path": "src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithVerticalTilting.java", "license": "mit", "size": 1732 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,595,761
public Collection<ManagedReference<CellComponentMO>> getAllComponentRefs() { return components.values(); }
Collection<ManagedReference<CellComponentMO>> function() { return components.values(); }
/** * Get all cell components associated with this cell * @return a collection of ManagedReferences to cell components */
Get all cell components associated with this cell
getAllComponentRefs
{ "repo_name": "AsherBond/MondocosmOS", "path": "wonderland/core/src/classes/org/jdesktop/wonderland/server/cell/CellMO.java", "license": "agpl-3.0", "size": 61615 }
[ "com.sun.sgs.app.ManagedReference", "java.util.Collection" ]
import com.sun.sgs.app.ManagedReference; import java.util.Collection;
import com.sun.sgs.app.*; import java.util.*;
[ "com.sun.sgs", "java.util" ]
com.sun.sgs; java.util;
1,916,597
public static void replaceInstructionAndUpdateDU(Instruction oldI, Instruction newI) { oldI.insertBefore(newI); removeInstructionAndUpdateDU(oldI); updateDUForNewInstruction(newI); }
static void function(Instruction oldI, Instruction newI) { oldI.insertBefore(newI); removeInstructionAndUpdateDU(oldI); updateDUForNewInstruction(newI); }
/** * Replace an instruction and update register lists. */
Replace an instruction and update register lists
replaceInstructionAndUpdateDU
{ "repo_name": "CodeOffloading/JikesRVM-CCO", "path": "jikesrvm-3.1.3/rvm/src/org/jikesrvm/compilers/opt/DefUse.java", "license": "epl-1.0", "size": 15478 }
[ "org.jikesrvm.compilers.opt.ir.Instruction" ]
import org.jikesrvm.compilers.opt.ir.Instruction;
import org.jikesrvm.compilers.opt.ir.*;
[ "org.jikesrvm.compilers" ]
org.jikesrvm.compilers;
971,688
public List<String> getProducedItemNames(final String clazz) { List<String> res = new LinkedList<String>(); for (final Pair<String, ProducerBehaviour> producer : producers) { final ProducerBehaviour behaviour = producer.second(); final String product = behaviour.getProductName(); final Item item = SingletonRepository.getEntityManager().getItem(product); if (item.isOfClass(clazz)) { res.add(product); } } for (final Pair<String, MultiProducerBehaviour> producer : multiproducers) { final MultiProducerBehaviour behaviour = producer.second(); for (String product : behaviour.getProductsNames()) { final Item item = SingletonRepository.getEntityManager().getItem(product); if (item.isOfClass(clazz)) { res.add(product); } } } return res; }
List<String> function(final String clazz) { List<String> res = new LinkedList<String>(); for (final Pair<String, ProducerBehaviour> producer : producers) { final ProducerBehaviour behaviour = producer.second(); final String product = behaviour.getProductName(); final Item item = SingletonRepository.getEntityManager().getItem(product); if (item.isOfClass(clazz)) { res.add(product); } } for (final Pair<String, MultiProducerBehaviour> producer : multiproducers) { final MultiProducerBehaviour behaviour = producer.second(); for (String product : behaviour.getProductsNames()) { final Item item = SingletonRepository.getEntityManager().getItem(product); if (item.isOfClass(clazz)) { res.add(product); } } } return res; }
/** * gets names of all items produced, which are of the given item class (i.e. food, drink) * * @param clazz Item class to check * @return list of item names */
gets names of all items produced, which are of the given item class (i.e. food, drink)
getProducedItemNames
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/server/entity/npc/behaviour/journal/ProducerRegister.java", "license": "gpl-2.0", "size": 13406 }
[ "games.stendhal.server.core.engine.SingletonRepository", "games.stendhal.server.entity.item.Item", "games.stendhal.server.entity.npc.behaviour.impl.MultiProducerBehaviour", "games.stendhal.server.entity.npc.behaviour.impl.ProducerBehaviour", "java.util.LinkedList", "java.util.List" ]
import games.stendhal.server.core.engine.SingletonRepository; import games.stendhal.server.entity.item.Item; import games.stendhal.server.entity.npc.behaviour.impl.MultiProducerBehaviour; import games.stendhal.server.entity.npc.behaviour.impl.ProducerBehaviour; import java.util.LinkedList; import java.util.List;
import games.stendhal.server.core.engine.*; import games.stendhal.server.entity.item.*; import games.stendhal.server.entity.npc.behaviour.impl.*; import java.util.*;
[ "games.stendhal.server", "java.util" ]
games.stendhal.server; java.util;
2,545,583
public FeatureCursor queryFeaturesForChunk(boolean distinct, BoundingBox boundingBox, String where, String[] whereArgs, String orderBy, int limit, long offset) { return queryFeaturesForChunk(distinct, boundingBox.buildEnvelope(), where, whereArgs, orderBy, limit, offset); }
FeatureCursor function(boolean distinct, BoundingBox boundingBox, String where, String[] whereArgs, String orderBy, int limit, long offset) { return queryFeaturesForChunk(distinct, boundingBox.buildEnvelope(), where, whereArgs, orderBy, limit, offset); }
/** * Query for features within the bounding box, starting at the offset and * returning no more than the limit * * @param distinct distinct rows * @param boundingBox bounding box * @param where where clause * @param whereArgs where arguments * @param orderBy order by * @param limit chunk limit * @param offset chunk query offset * @return feature cursor * @since 6.2.0 */
Query for features within the bounding box, starting at the offset and returning no more than the limit
queryFeaturesForChunk
{ "repo_name": "ngageoint/geopackage-android", "path": "geopackage-sdk/src/main/java/mil/nga/geopackage/extension/nga/index/FeatureTableIndex.java", "license": "mit", "size": 276322 }
[ "mil.nga.geopackage.BoundingBox", "mil.nga.geopackage.features.user.FeatureCursor" ]
import mil.nga.geopackage.BoundingBox; import mil.nga.geopackage.features.user.FeatureCursor;
import mil.nga.geopackage.*; import mil.nga.geopackage.features.user.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
347,251
try (ModelControllerClient modelControllerClient = TestSuiteEnvironment.getModelControllerClient()) { modelControllerClient.execute(Operations.createReadAttributeOperation(new ModelNode().setEmptyList(), "server-state")); Assert.fail("Operation should have failed, but was successful"); } }
try (ModelControllerClient modelControllerClient = TestSuiteEnvironment.getModelControllerClient()) { modelControllerClient.execute(Operations.createReadAttributeOperation(new ModelNode().setEmptyList(), STR)); Assert.fail(STR); } }
/** * This test checks that CLI access is secured. * * @throws Exception We do not provide any credentials so the IOException is required to be thrown. */
This test checks that CLI access is secured
testConnect
{ "repo_name": "jamezp/wildfly-core", "path": "testsuite/standalone/src/test/java/org/jboss/as/test/integration/security/perimeter/DMRSecurityTestCase.java", "license": "lgpl-2.1", "size": 2042 }
[ "org.jboss.as.controller.client.ModelControllerClient", "org.jboss.as.controller.client.helpers.Operations", "org.jboss.as.test.shared.TestSuiteEnvironment", "org.jboss.dmr.ModelNode", "org.junit.Assert" ]
import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.as.controller.client.helpers.Operations; import org.jboss.as.test.shared.TestSuiteEnvironment; import org.jboss.dmr.ModelNode; import org.junit.Assert;
import org.jboss.as.controller.client.*; import org.jboss.as.controller.client.helpers.*; import org.jboss.as.test.shared.*; import org.jboss.dmr.*; import org.junit.*;
[ "org.jboss.as", "org.jboss.dmr", "org.junit" ]
org.jboss.as; org.jboss.dmr; org.junit;
2,739,722
public static boolean isGrantType(final String type, final OAuth20GrantTypes expectedType) { return expectedType.name().equalsIgnoreCase(type); }
static boolean function(final String type, final OAuth20GrantTypes expectedType) { return expectedType.name().equalsIgnoreCase(type); }
/** * Check the grant type against an expected grant type. * * @param type the given grant type * @param expectedType the expected grant type * @return whether the grant type is the expected one */
Check the grant type against an expected grant type
isGrantType
{ "repo_name": "pdrados/cas", "path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java", "license": "apache-2.0", "size": 20919 }
[ "org.apereo.cas.support.oauth.OAuth20GrantTypes" ]
import org.apereo.cas.support.oauth.OAuth20GrantTypes;
import org.apereo.cas.support.oauth.*;
[ "org.apereo.cas" ]
org.apereo.cas;
2,013,002
void updateNetworkSelection(int serviceState) { if (TelephonyCapabilities.supportsNetworkSelection(mPhone)) { int subId = mPhone.getSubId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { // get the shared preference of network_selection. // empty is auto mode, otherwise it is the operator alpha name // in case there is no operator name, check the operator numeric SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); String networkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, ""); if (TextUtils.isEmpty(networkSelection)) { networkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_KEY + subId, ""); } if (DBG) log("updateNetworkSelection()..." + "state = " + serviceState + " new network " + networkSelection); if (serviceState == ServiceState.STATE_OUT_OF_SERVICE && !TextUtils.isEmpty(networkSelection)) { if (!mSelectedUnavailableNotify) { showNetworkSelection(networkSelection); mSelectedUnavailableNotify = true; } } else { if (mSelectedUnavailableNotify) { cancelNetworkSelection(); mSelectedUnavailableNotify = false; } } } else { if (DBG) log("updateNetworkSelection()..." + "state = " + serviceState + " not updating network due to invalid subId " + subId); } } }
void updateNetworkSelection(int serviceState) { if (TelephonyCapabilities.supportsNetworkSelection(mPhone)) { int subId = mPhone.getSubId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); String networkSelection = sp.getString(PhoneBase.NETWORK_SELECTION_NAME_KEY + subId, STRSTRupdateNetworkSelection()...STRstate = STR new network STRupdateNetworkSelection()...STRstate = STR not updating network due to invalid subId " + subId); } } }
/** * Update notification about no service of user selected operator * * @param serviceState Phone service state */
Update notification about no service of user selected operator
updateNetworkSelection
{ "repo_name": "md5555/android_packages_services_Telephony", "path": "src/com/android/phone/NotificationMgr.java", "license": "apache-2.0", "size": 27247 }
[ "android.content.SharedPreferences", "android.preference.PreferenceManager", "android.telephony.SubscriptionManager", "com.android.internal.telephony.PhoneBase", "com.android.internal.telephony.TelephonyCapabilities" ]
import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.telephony.SubscriptionManager; import com.android.internal.telephony.PhoneBase; import com.android.internal.telephony.TelephonyCapabilities;
import android.content.*; import android.preference.*; import android.telephony.*; import com.android.internal.telephony.*;
[ "android.content", "android.preference", "android.telephony", "com.android.internal" ]
android.content; android.preference; android.telephony; com.android.internal;
2,560,505
@Override public void removeSet(String label) { try { conn.setAutoCommit(false); removeSetFromSetContentsPS.setString(1, label); removeSetFromSetsPS.setString(1, label); removeSetFromSetContentsPS.executeUpdate(); removeSetFromSetsPS.executeUpdate(); conn.commit(); conn.setAutoCommit(true); } catch (SQLException ex) { ex.printStackTrace(); } fireSetsChangedEvent(); }
void function(String label) { try { conn.setAutoCommit(false); removeSetFromSetContentsPS.setString(1, label); removeSetFromSetsPS.setString(1, label); removeSetFromSetContentsPS.executeUpdate(); removeSetFromSetsPS.executeUpdate(); conn.commit(); conn.setAutoCommit(true); } catch (SQLException ex) { ex.printStackTrace(); } fireSetsChangedEvent(); }
/** * Remove the set with the specified label from the database. * * @param label * The label of the set that should be removed. */
Remove the set with the specified label from the database
removeSet
{ "repo_name": "posborne/mango-movie-manager", "path": "src/com/themangoproject/db/h2/H2SetsDAO.java", "license": "mit", "size": 9109 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,445,737
private IStatus run(IProject project, List<IResource> resources, IProgressMonitor monitor) { System.err.println("Start manual build... "); SubMonitor progress = SubMonitor.convert(monitor); jutils.setProject(project); try { // Only perform builds on builders registered with our build service ICommonBuildService buildService = (ICommonBuildService) PlatformUI.getWorkbench().getService(ICommonBuildService.class); List<ICommand> commands = new LinkedList<ICommand>(); IProjectDescription desc = project.getDescription(); for (ICommand command : desc.getBuildSpec()) { String name = command.getBuilderName(); if(buildService.containsBuilder(name)) { commands.add(command); } } Map<String,String> args = new HashMap<String,String>(); if(resources != null) { // For a build of selected resources, ensure the resources // are added to a lookup table. args.put("type", MANUAL_BUILD); for(IResource resource: resources) { addFiles(args, resource); } } else { args.put("type", MANUAL_BUILD_ALL); } progress.setWorkRemaining(commands.size()); for (ICommand command : commands) { System.err.println("Running builder " + command.getBuilderName() + "..."); try { project.build(IncrementalProjectBuilder.FULL_BUILD, command.getBuilderName(), args, progress.newChild(1)); } catch (CoreException e) { e.printStackTrace(); } } } catch (CoreException e) { e.printStackTrace(); } System.err.println("Manual build complete"); return Status.OK_STATUS; }
IStatus function(IProject project, List<IResource> resources, IProgressMonitor monitor) { System.err.println(STR); SubMonitor progress = SubMonitor.convert(monitor); jutils.setProject(project); try { ICommonBuildService buildService = (ICommonBuildService) PlatformUI.getWorkbench().getService(ICommonBuildService.class); List<ICommand> commands = new LinkedList<ICommand>(); IProjectDescription desc = project.getDescription(); for (ICommand command : desc.getBuildSpec()) { String name = command.getBuilderName(); if(buildService.containsBuilder(name)) { commands.add(command); } } Map<String,String> args = new HashMap<String,String>(); if(resources != null) { args.put("type", MANUAL_BUILD); for(IResource resource: resources) { addFiles(args, resource); } } else { args.put("type", MANUAL_BUILD_ALL); } progress.setWorkRemaining(commands.size()); for (ICommand command : commands) { System.err.println(STR + command.getBuilderName() + "..."); try { project.build(IncrementalProjectBuilder.FULL_BUILD, command.getBuilderName(), args, progress.newChild(1)); } catch (CoreException e) { e.printStackTrace(); } } } catch (CoreException e) { e.printStackTrace(); } System.err.println(STR); return Status.OK_STATUS; }
/** Run a build on the selected project, optionally passing a list of resources * as build arguments. * * @param project * @param resources * @param monitor * @return */
Run a build on the selected project, optionally passing a list of resources as build arguments
run
{ "repo_name": "OSSIndex/eclipse-common-build", "path": "plugins/net.ossindex.eclipse.common.builder/src/net/ossindex/eclipse/common/builder/ManualBuildJob.java", "license": "bsd-3-clause", "size": 6283 }
[ "java.util.HashMap", "java.util.LinkedList", "java.util.List", "java.util.Map", "net.ossindex.eclipse.common.builder.service.ICommonBuildService", "org.eclipse.core.resources.ICommand", "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IProjectDescription", "org.eclipse.core.resources.IResource", "org.eclipse.core.resources.IncrementalProjectBuilder", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IProgressMonitor", "org.eclipse.core.runtime.IStatus", "org.eclipse.core.runtime.Status", "org.eclipse.core.runtime.SubMonitor", "org.eclipse.ui.PlatformUI" ]
import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import net.ossindex.eclipse.common.builder.service.ICommonBuildService; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.ui.PlatformUI;
import java.util.*; import net.ossindex.eclipse.common.builder.service.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.ui.*;
[ "java.util", "net.ossindex.eclipse", "org.eclipse.core", "org.eclipse.ui" ]
java.util; net.ossindex.eclipse; org.eclipse.core; org.eclipse.ui;
641,957
private IResult doBootstrap() { IResult result = new ResultPojo(); result.setResultObject(new Boolean(true)); // optimistic default value //CLASSES makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.BLOG_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Blog Publication Type", "The TopicQuests Biblio typology blog publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.BOOK_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Book Publication Type", "The TopicQuests Biblio typology book publication type.", result); makeSubclassNode(ITopicQuestsOntology.NODE_TYPE,IBiblioLegend.CITATION_NODE_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Citation Node Type", "The TopicQuests Biblio typology citation node type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.DATABASE_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Database Publication Type", "The TopicQuests Biblio typology database publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.JOURNAL_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Journal Publication Type", "The TopicQuests Biblio typology journal publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.NEWSPAPER_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Newspaper Publication Type", "The TopicQuests Biblio typology newspaper publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.OTHER_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Other Publication Type", "The TopicQuests Biblio typology other publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.PATENT_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Patent Publication Type", "The TopicQuests Biblio typology patent publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.REPORT_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Report Publication Type", "The TopicQuests Biblio typology report publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.WEBPAGE_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Webpage Publication Type", "The TopicQuests Biblio typology webpage publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.WIKI_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Wiki Publication Type", "The TopicQuests Biblio typology wiki publication type.", result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.MICROBLOG_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,"Microblog Publication Type", "The TopicQuests Biblio typology microblog publication type.", result); //PROPERTIES makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.AFFILIATIONS_LIST_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Affiliations List Property Type", "The TopicQuests Biblio typology affiliations list property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.AUTHOR_LIST_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Author List Property Type", "The TopicQuests Biblio typology cluster author list property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.DOI_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"DOI Property Type", "The TopicQuests Biblio typology DOI property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.ISBN_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"ISBN Property Type", "The TopicQuests Biblio typology ISBN property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.ISSN_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"ISSN Property Type", "The TopicQuests Biblio typology ISSN property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_NUMBER_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Journal Number Property Type", "The TopicQuests Biblio typology journal number property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_TITLE_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Journal Title Property Type", "The TopicQuests Biblio typology journal title property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_VOLUME_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Journal Volume Property Type", "The TopicQuests Biblio typology journal volume property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.LANGUAGES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Languages Property Type", "The TopicQuests Biblio typology languages property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PAGES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Pages Property Type", "The TopicQuests Biblio typology pages property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLICATION_DATE_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Publication Date Property Type", "The TopicQuests Biblio typology publication date property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLICATION_TYPES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Publication Types Property Type", "The TopicQuests Biblio typology publication types property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLISHER_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Publisher Property Type", "The TopicQuests Biblio typology publisher property type.", result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.RIGHTS_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,"Rights Property Type", "The TopicQuests Biblio typology rights property type.", result); return result; }
IResult function() { IResult result = new ResultPojo(); result.setResultObject(new Boolean(true)); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.BLOG_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.BOOK_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.NODE_TYPE,IBiblioLegend.CITATION_NODE_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.DATABASE_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.JOURNAL_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.NEWSPAPER_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.OTHER_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.PATENT_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.REPORT_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.WEBPAGE_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.WIKI_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.CLASS_TYPE,IBiblioLegend.MICROBLOG_PUBLICATION_TYPE,ICoreIcons.CLASS_ICON_SM,ICoreIcons.CLASS_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.AFFILIATIONS_LIST_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.AUTHOR_LIST_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.DOI_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.ISBN_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.ISSN_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_NUMBER_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_TITLE_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.JOURNAL_VOLUME_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.LANGUAGES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PAGES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLICATION_DATE_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLICATION_TYPES_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.PUBLISHER_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); makeSubclassNode(ITopicQuestsOntology.PROPERTY_TYPE,IBiblioLegend.RIGHTS_PROPERTY,ICoreIcons.PROPERTY_ICON_SM,ICoreIcons.PROPERTY_ICON,STR, STR, result); return result; }
/** * Returns a Boolean <code>true</code> if everything bootstraps well; otherwise <code>false</code> * @return */
Returns a Boolean <code>true</code> if everything bootstraps well; otherwise <code>false</code>
doBootstrap
{ "repo_name": "agibsonccc/solrsherlock-maven", "path": "solrsherlock-parent/solrsherlock-core/src/main/java/org/topicquests/model/BiblioBootstrap.java", "license": "apache-2.0", "size": 8196 }
[ "org.topicquests.common.ResultPojo", "org.topicquests.common.api.IBiblioLegend", "org.topicquests.common.api.ICoreIcons", "org.topicquests.common.api.IResult", "org.topicquests.common.api.ITopicQuestsOntology" ]
import org.topicquests.common.ResultPojo; import org.topicquests.common.api.IBiblioLegend; import org.topicquests.common.api.ICoreIcons; import org.topicquests.common.api.IResult; import org.topicquests.common.api.ITopicQuestsOntology;
import org.topicquests.common.*; import org.topicquests.common.api.*;
[ "org.topicquests.common" ]
org.topicquests.common;
2,001,947
protected void addTransportRabbitMqExchangeNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_InboundEndpoint_transportRabbitMqExchangeName_feature"), getString("_UI_PropertyDescriptor_description", "_UI_InboundEndpoint_transportRabbitMqExchangeName_feature", "_UI_InboundEndpoint_type"), EsbPackage.Literals.INBOUND_ENDPOINT__TRANSPORT_RABBIT_MQ_EXCHANGE_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.INBOUND_ENDPOINT__TRANSPORT_RABBIT_MQ_EXCHANGE_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Transport Rabbit Mq Exchange Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Transport Rabbit Mq Exchange Name feature.
addTransportRabbitMqExchangeNamePropertyDescriptor
{ "repo_name": "nwnpallewela/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/InboundEndpointItemProvider.java", "license": "apache-2.0", "size": 165854 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
2,530,680
@Test public void testCreateImageFromUrl() { assertTrue(server.createImageFromUrl(VALID_CREATE_IDENTIFIER, VALID_IMAGE_URL, VALID_META_DATA, createResponse)); }
void function() { assertTrue(server.createImageFromUrl(VALID_CREATE_IDENTIFIER, VALID_IMAGE_URL, VALID_META_DATA, createResponse)); }
/** * assert the creation of an image via URL to success */
assert the creation of an image via URL to success
testCreateImageFromUrl
{ "repo_name": "Metalcon/imageStorageServer", "path": "src/test/java/de/metalcon/imageServer/ImageStorageServerTest.java", "license": "gpl-3.0", "size": 23846 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
864,046
private double getNumericalSize(String documentSize) { return Double.parseDouble(StringUtils.substringBefore(documentSize, " bytes")); }
double function(String documentSize) { return Double.parseDouble(StringUtils.substringBefore(documentSize, STR)); }
/** * Removes " bytes" and returns number. * * @param documentSize * @return */
Removes " bytes" and returns number
getNumericalSize
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/qa-share/src/test/java/org/alfresco/share/api/cmis/CMISAppendTest.java", "license": "lgpl-3.0", "size": 8415 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
2,684,085
private void onChannelTerminated() { if (usingSharedExecutor) { SharedResourceHolder.release(GrpcUtil.SHARED_CHANNEL_EXECUTOR, (ExecutorService) executor); } // Release the transport factory so that it can deallocate any resources. transportFactory.release(); }
void function() { if (usingSharedExecutor) { SharedResourceHolder.release(GrpcUtil.SHARED_CHANNEL_EXECUTOR, (ExecutorService) executor); } transportFactory.release(); }
/** * If we're using the shared executor, returns its reference. */
If we're using the shared executor, returns its reference
onChannelTerminated
{ "repo_name": "madongfly/grpc-java", "path": "core/src/main/java/io/grpc/internal/ManagedChannelImpl.java", "license": "bsd-3-clause", "size": 14900 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,737,208
public static String getDescWithoutMethodName(Method m) { StringBuilder ret = new StringBuilder(); ret.append('('); Class<?>[] parameterTypes = m.getParameterTypes(); for(int i=0;i<parameterTypes.length;i++) ret.append(getDesc(parameterTypes[i])); ret.append(')').append(getDesc(m.getReturnType())); return ret.toString(); }
static String function(Method m) { StringBuilder ret = new StringBuilder(); ret.append('('); Class<?>[] parameterTypes = m.getParameterTypes(); for(int i=0;i<parameterTypes.length;i++) ret.append(getDesc(parameterTypes[i])); ret.append(')').append(getDesc(m.getReturnType())); return ret.toString(); }
/** * get method desc. * "(I)I", "()V", "(Ljava/lang/String;Z)V" * * @param m method. * @return desc. */
get method desc. "(I)I", "()V", "(Ljava/lang/String;Z)V"
getDescWithoutMethodName
{ "repo_name": "yujiasun/dubbo", "path": "dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java", "license": "apache-2.0", "size": 32685 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,667,364
private Pair<String, Integer> getHelixClusterLeader() { String helixLeader = LeadControllerUtils.getHelixClusterLeader(_helixManager); return convertToHostAndPortPair(helixLeader); }
Pair<String, Integer> function() { String helixLeader = LeadControllerUtils.getHelixClusterLeader(_helixManager); return convertToHostAndPortPair(helixLeader); }
/** * Gets Helix leader in the cluster. Null if there is no leader. * @return instance id of Helix cluster leader, e.g. localhost_9000. */
Gets Helix leader in the cluster. Null if there is no leader
getHelixClusterLeader
{ "repo_name": "linkedin/pinot", "path": "pinot-core/src/main/java/org/apache/pinot/server/realtime/ControllerLeaderLocator.java", "license": "apache-2.0", "size": 11679 }
[ "org.apache.pinot.common.utils.helix.LeadControllerUtils", "org.apache.pinot.pql.parsers.utils.Pair" ]
import org.apache.pinot.common.utils.helix.LeadControllerUtils; import org.apache.pinot.pql.parsers.utils.Pair;
import org.apache.pinot.common.utils.helix.*; import org.apache.pinot.pql.parsers.utils.*;
[ "org.apache.pinot" ]
org.apache.pinot;
687,582
void scrapActiveViews() { final View[] activeViews = mActiveViews; final boolean hasListener = mRecyclerListener != null; final boolean multipleScraps = mViewTypeCount > 1; ArrayList<View> scrapViews = mCurrentScrap; final int count = activeViews.length; for (int i = count - 1; i >= 0; i--) { final View victim = activeViews[i]; if (victim != null) { final AbsListView.LayoutParams lp = (AbsListView.LayoutParams) victim.getLayoutParams(); final int whichScrap = lp.viewType; activeViews[i] = null; if (victim.hasTransientState()) { // Store views with transient state for later use. victim.dispatchStartTemporaryDetach(); if (mAdapter != null && mAdapterHasStableIds) { if (mTransientStateViewsById == null) { mTransientStateViewsById = new LongSparseArray<View>(); } long id = mAdapter.getItemId(mFirstActivePosition + i); mTransientStateViewsById.put(id, victim); } else if (!mDataChanged) { if (mTransientStateViews == null) { mTransientStateViews = new SparseArray<View>(); } mTransientStateViews.put(mFirstActivePosition + i, victim); } else if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) { // The data has changed, we can't keep this view. removeDetachedView(victim, false); } } else if (!shouldRecycleViewType(whichScrap)) { // Discard non-recyclable views except headers/footers. if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) { removeDetachedView(victim, false); } } else { // Store everything else on the appropriate scrap heap. if (multipleScraps) { scrapViews = mScrapViews[whichScrap]; } lp.scrappedFromPosition = mFirstActivePosition + i; removeDetachedView(victim, false); scrapViews.add(victim); if (hasListener) { mRecyclerListener.onMovedToScrapHeap(victim); } } } } pruneScrapViews(); }
void scrapActiveViews() { final View[] activeViews = mActiveViews; final boolean hasListener = mRecyclerListener != null; final boolean multipleScraps = mViewTypeCount > 1; ArrayList<View> scrapViews = mCurrentScrap; final int count = activeViews.length; for (int i = count - 1; i >= 0; i--) { final View victim = activeViews[i]; if (victim != null) { final AbsListView.LayoutParams lp = (AbsListView.LayoutParams) victim.getLayoutParams(); final int whichScrap = lp.viewType; activeViews[i] = null; if (victim.hasTransientState()) { victim.dispatchStartTemporaryDetach(); if (mAdapter != null && mAdapterHasStableIds) { if (mTransientStateViewsById == null) { mTransientStateViewsById = new LongSparseArray<View>(); } long id = mAdapter.getItemId(mFirstActivePosition + i); mTransientStateViewsById.put(id, victim); } else if (!mDataChanged) { if (mTransientStateViews == null) { mTransientStateViews = new SparseArray<View>(); } mTransientStateViews.put(mFirstActivePosition + i, victim); } else if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) { removeDetachedView(victim, false); } } else if (!shouldRecycleViewType(whichScrap)) { if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER) { removeDetachedView(victim, false); } } else { if (multipleScraps) { scrapViews = mScrapViews[whichScrap]; } lp.scrappedFromPosition = mFirstActivePosition + i; removeDetachedView(victim, false); scrapViews.add(victim); if (hasListener) { mRecyclerListener.onMovedToScrapHeap(victim); } } } } pruneScrapViews(); }
/** * Move all views remaining in mActiveViews to mScrapViews. */
Move all views remaining in mActiveViews to mScrapViews
scrapActiveViews
{ "repo_name": "xorware/android_frameworks_base", "path": "core/java/android/widget/AbsListView.java", "license": "apache-2.0", "size": 278926 }
[ "android.util.LongSparseArray", "android.util.SparseArray", "android.view.View", "java.util.ArrayList" ]
import android.util.LongSparseArray; import android.util.SparseArray; import android.view.View; import java.util.ArrayList;
import android.util.*; import android.view.*; import java.util.*;
[ "android.util", "android.view", "java.util" ]
android.util; android.view; java.util;
2,392,880
public static JSONObject updateCollection(String apiKey, String uuid, String name) throws CatchoomException, IOException, NoSuchAlgorithmException { JSONObject data; if (name != null) { data = new JSONObject(); data.put("name", name); } else { data = null; } return Commons.updateObject(apiKey, "collection", uuid, data, PROXY); }
static JSONObject function(String apiKey, String uuid, String name) throws CatchoomException, IOException, NoSuchAlgorithmException { JSONObject data; if (name != null) { data = new JSONObject(); data.put("name", name); } else { data = null; } return Commons.updateObject(apiKey, STR, uuid, data, PROXY); }
/** * Update the collection name, identified by uuid * * @param apiKey your API key * @param uuid the collection uuid * @param name the new name of the collection * @return a JSON object with the server response * @throws CatchoomException if the parameters are incorrect or the server response is not valid * @throws IOException if something goes wrong in the interaction with the server * @throws java.security.NoSuchAlgorithmException if TLS 1.2 is not available */
Update the collection name, identified by uuid
updateCollection
{ "repo_name": "NoxWizard86/JCraftAR", "path": "src/main/java/com/noxwizard/jcraftar/Management.java", "license": "apache-2.0", "size": 40315 }
[ "java.io.IOException", "java.security.NoSuchAlgorithmException", "org.json.JSONObject" ]
import java.io.IOException; import java.security.NoSuchAlgorithmException; import org.json.JSONObject;
import java.io.*; import java.security.*; import org.json.*;
[ "java.io", "java.security", "org.json" ]
java.io; java.security; org.json;
2,623,104
public IFile getModelFile() { return newFileCreationPage.getModelFile(); }
IFile function() { return newFileCreationPage.getModelFile(); }
/** * Get the file from the page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Get the file from the page.
getModelFile
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.editor/src/de/dfki/iui/basys/model/domain/workerguidance/presentation/WorkerguidanceModelWizard.java", "license": "epl-1.0", "size": 18693 }
[ "org.eclipse.core.resources.IFile" ]
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.*;
[ "org.eclipse.core" ]
org.eclipse.core;
682,326
@ServiceMethod(returns = ReturnType.SINGLE) public NetAppAccountInner getByResourceGroup(String resourceGroupName, String accountName) { return getByResourceGroupAsync(resourceGroupName, accountName).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) NetAppAccountInner function(String resourceGroupName, String accountName) { return getByResourceGroupAsync(resourceGroupName, accountName).block(); }
/** * Get the NetApp account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the NetApp account. */
Get the NetApp account
getByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java", "license": "mit", "size": 75086 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.netapp.fluent.models.NetAppAccountInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.netapp.fluent.models.NetAppAccountInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.netapp.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,807,787
boolean contains(Point2D p);
boolean contains(Point2D p);
/** * Returns true if the specified Point2D is inside the boundary of this * node, false otherwise. * * @param p the specified Point2D in the user space */
Returns true if the specified Point2D is inside the boundary of this node, false otherwise
contains
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/gvt/GraphicsNode.java", "license": "apache-2.0", "size": 13662 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
387,824
public boolean tryUpdate(ITupleReference tuple) throws HyracksDataException, IndexException;
boolean function(ITupleReference tuple) throws HyracksDataException, IndexException;
/** * Attempts to update the given tuple. * If the update would have to wait for a flush to complete, then this method returns false to * allow the caller to avoid potential deadlock situations. * Otherwise, returns true (update was successful). * * @param tuple * Tuple whose match in the index is to be update with the given * tuples contents. * @throws HyracksDataException * If the BufferCache throws while un/pinning or un/latching. * @throws IndexException * If there is no matching tuple in the index. */
Attempts to update the given tuple. If the update would have to wait for a flush to complete, then this method returns false to allow the caller to avoid potential deadlock situations. Otherwise, returns true (update was successful)
tryUpdate
{ "repo_name": "lwhay/hyracks", "path": "hyracks/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIndexAccessor.java", "license": "apache-2.0", "size": 5231 }
[ "edu.uci.ics.hyracks.api.exceptions.HyracksDataException", "edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference", "edu.uci.ics.hyracks.storage.am.common.api.IndexException" ]
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException; import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference; import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
import edu.uci.ics.hyracks.api.exceptions.*; import edu.uci.ics.hyracks.dataflow.common.data.accessors.*; import edu.uci.ics.hyracks.storage.am.common.api.*;
[ "edu.uci.ics" ]
edu.uci.ics;
1,930,380
int resID = GameEngine.getAppContext().getResources() .getIdentifier(resId, "raw", GameEngine.getAppContext().getPackageName()); MediaPlayer mp = MediaPlayer.create(GameEngine.getAppContext(), resID);
int resID = GameEngine.getAppContext().getResources() .getIdentifier(resId, "raw", GameEngine.getAppContext().getPackageName()); MediaPlayer mp = MediaPlayer.create(GameEngine.getAppContext(), resID);
/** * Plays the specified music. * * @param resId * The name of the music that needs to played. */
Plays the specified music
play
{ "repo_name": "ddoa/game-api-android", "path": "src/android/gameengine/icadroids/sound/MusicPlayer.java", "license": "mit", "size": 2016 }
[ "android.gameengine.icadroids.engine.GameEngine", "android.media.MediaPlayer" ]
import android.gameengine.icadroids.engine.GameEngine; import android.media.MediaPlayer;
import android.gameengine.icadroids.engine.*; import android.media.*;
[ "android.gameengine", "android.media" ]
android.gameengine; android.media;
2,090,004
protected void checkAuthWithPromptNoneReturnsInteractionRequired() { authenticateDirectlyInIDP(); driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName())); waitForPage(driver, "sign in to", true); String url = driver.getCurrentUrl() + "&kc_idp_hint=" + bc.getIDPAlias() + "&prompt=none"; driver.navigate().to(url); Assert.assertTrue(driver.getCurrentUrl().contains(bc.consumerRealmName() + "/account/login-redirect?error=interaction_required")); }
void function() { authenticateDirectlyInIDP(); driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName())); waitForPage(driver, STR, true); String url = driver.getCurrentUrl() + STR + bc.getIDPAlias() + STR; driver.navigate().to(url); Assert.assertTrue(driver.getCurrentUrl().contains(bc.consumerRealmName() + STR)); }
/** * Utility method that authenticates the broker user directly in the IDP to establish a session there. It then proceeds to * send an auth request to the account app in the consumer realm with {@code prompt=none}, checking that the resulting page * is an error page containing the {@code interaction_required} message. */
Utility method that authenticates the broker user directly in the IDP to establish a session there. It then proceeds to send an auth request to the account app in the consumer realm with prompt=none, checking that the resulting page is an error page containing the interaction_required message
checkAuthWithPromptNoneReturnsInteractionRequired
{ "repo_name": "thomasdarimont/keycloak", "path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerPromptNoneRedirectTest.java", "license": "apache-2.0", "size": 13859 }
[ "org.keycloak.testsuite.Assert", "org.keycloak.testsuite.broker.BrokerTestTools" ]
import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.broker.BrokerTestTools;
import org.keycloak.testsuite.*; import org.keycloak.testsuite.broker.*;
[ "org.keycloak.testsuite" ]
org.keycloak.testsuite;
191,981
public static ArrayList<Map> sortByDuration(ArrayList<Map> unsortedList, boolean way) { ArrayList<Map> sortedList = new ArrayList<Map>(unsortedList); if(way) Collections.sort(sortedList, new SortByDuration()); else Collections.sort(sortedList, Collections.reverseOrder(new SortByDuration())); return sortedList; }
static ArrayList<Map> function(ArrayList<Map> unsortedList, boolean way) { ArrayList<Map> sortedList = new ArrayList<Map>(unsortedList); if(way) Collections.sort(sortedList, new SortByDuration()); else Collections.sort(sortedList, Collections.reverseOrder(new SortByDuration())); return sortedList; }
/** Sorts the specified list according to the order induced by the specified comparator (sortByDuration). * * @param unsortedList : the list to be sorted * @param way : reverse order or not * @return the sorted list */
Sorts the specified list according to the order induced by the specified comparator (sortByDuration)
sortByDuration
{ "repo_name": "Epono/TheParkKeeper", "path": "src/management/Tri.java", "license": "gpl-2.0", "size": 4277 }
[ "java.util.ArrayList", "java.util.Collections" ]
import java.util.ArrayList; import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
23,368
public void setQuestionDate(Date questionDate) { this.questionDate = questionDate; }
void function(Date questionDate) { this.questionDate = questionDate; }
/** * Set the date when question was asked */
Set the date when question was asked
setQuestionDate
{ "repo_name": "CecileBONIN/Silverpeas-Core", "path": "ejb-core/formtemplate/src/main/java/com/silverpeas/workflow/engine/instance/QuestionImpl.java", "license": "agpl-3.0", "size": 8583 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,367,815
@Test public void testEqualsToObjectVersionNull() { final DoublesPair b = DoublesPair.of(1.1d, 1.7d); final Pair<Double, Double> a = ObjectsPair.of(null, Double.valueOf(1.9d)); assertEquals(true, a.equals(a)); assertEquals(false, a.equals(b)); assertEquals(false, b.equals(a)); assertEquals(true, b.equals(b)); }
void function() { final DoublesPair b = DoublesPair.of(1.1d, 1.7d); final Pair<Double, Double> a = ObjectsPair.of(null, Double.valueOf(1.9d)); assertEquals(true, a.equals(a)); assertEquals(false, a.equals(b)); assertEquals(false, b.equals(a)); assertEquals(true, b.equals(b)); }
/** * Tests the equals() method. */
Tests the equals() method
testEqualsToObjectVersionNull
{ "repo_name": "McLeodMoores/starling", "path": "projects/util/src/test/java/com/opengamma/util/tuple/DoublesPairTest.java", "license": "apache-2.0", "size": 10517 }
[ "org.testng.Assert" ]
import org.testng.Assert;
import org.testng.*;
[ "org.testng" ]
org.testng;
1,049,104
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING))); }
IBlockState function(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING))); }
/** * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed * blockstate. */
Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed blockstate
withMirror
{ "repo_name": "InverMN/MinecraftForgeReference", "path": "MinecraftBlocks2/BlockWallSign.java", "license": "unlicense", "size": 3970 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.EnumFacing", "net.minecraft.util.Mirror" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.Mirror;
import net.minecraft.block.state.*; import net.minecraft.util.*;
[ "net.minecraft.block", "net.minecraft.util" ]
net.minecraft.block; net.minecraft.util;
2,658,843
public static <T> List<T> getListValue(List<T> list) { if (list == null) { return Collections.emptyList(); } return list; }
static <T> List<T> function(List<T> list) { if (list == null) { return Collections.emptyList(); } return list; }
/** * This is a convenience method that essentially checks for a null list and returns Collections.emptyList in that * case. If the list is non-null, then this is an identity function. * * @param <T> * @param list * @return */
This is a convenience method that essentially checks for a null list and returns Collections.emptyList in that case. If the list is non-null, then this is an identity function
getListValue
{ "repo_name": "apicloudcom/APICloud-Studio", "path": "com.aptana.core/src/com/aptana/core/util/CollectionsUtil.java", "license": "gpl-3.0", "size": 24731 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,270,587
public void attributeRemoved(HttpSessionBindingEvent event) { // If the old value is an AbstractSessionBean, notify it Object value = event.getValue(); if ((value != null) && (value instanceof AbstractSessionBean)) { ((AbstractSessionBean) value).destroy(); } } //@} HttpSessionAttributeListener implementation /////////////////////// //@{ ServletRequestListener implementation /////////////////////////////
void function(HttpSessionBindingEvent event) { Object value = event.getValue(); if ((value != null) && (value instanceof AbstractSessionBean)) { ((AbstractSessionBean) value).destroy(); } }
/** * <p>Respond to a session scope attribute being removed. * If the old value was an {@link AbstractSessionBean}, call * its <code>destroy()</code> method.</p> * * @param event Event to be processed */
Respond to a session scope attribute being removed. If the old value was an <code>AbstractSessionBean</code>, call its <code>destroy()</code> method
attributeRemoved
{ "repo_name": "sguazt/dcsj-sharegrid-portal", "path": "src/java/it/unipmn/di/dcs/sharegrid/web/faces/servlet/LifecycleListener.java", "license": "gpl-3.0", "size": 20140 }
[ "it.unipmn.di.dcs.sharegrid.web.faces.view.AbstractSessionBean", "javax.servlet.http.HttpSessionBindingEvent" ]
import it.unipmn.di.dcs.sharegrid.web.faces.view.AbstractSessionBean; import javax.servlet.http.HttpSessionBindingEvent;
import it.unipmn.di.dcs.sharegrid.web.faces.view.*; import javax.servlet.http.*;
[ "it.unipmn.di", "javax.servlet" ]
it.unipmn.di; javax.servlet;
2,429,954
public void addProxyServer(ProxyServer proxyServer) { proxyServers.add(proxyServer); extensionHooks.values().forEach(extHook -> hookProxyServer(extHook, proxyServer)); }
void function(ProxyServer proxyServer) { proxyServers.add(proxyServer); extensionHooks.values().forEach(extHook -> hookProxyServer(extHook, proxyServer)); }
/** * Adds the given proxy server, to be automatically updated with proxy related listeners. * * @param proxyServer the proxy server to add, must not be null. * @since 2.8.0 * @see #removeProxyServer(ProxyServer) */
Adds the given proxy server, to be automatically updated with proxy related listeners
addProxyServer
{ "repo_name": "meitar/zaproxy", "path": "zap/src/main/java/org/parosproxy/paros/extension/ExtensionLoader.java", "license": "apache-2.0", "size": 57249 }
[ "org.parosproxy.paros.core.proxy.ProxyServer" ]
import org.parosproxy.paros.core.proxy.ProxyServer;
import org.parosproxy.paros.core.proxy.*;
[ "org.parosproxy.paros" ]
org.parosproxy.paros;
2,343,702
@SuppressWarnings("unchecked") @Test public void testAddScriptForExistingEndpoint() { String filter = "name:type"; Calendar now = Calendar.getInstance(); Row<String, String> row0 = mockRow(); ColumnList<String> columnList0 = mockColumnList(row0); mockColumn(columnList0, "filter_id", filter); mockColumn(columnList0, "revision", 1L); mockColumn(columnList0, "active", false); mockColumn(columnList0, "creation_date", now.getTime()); mockColumn(columnList0, "filter_code", "script body 1".getBytes()); mockColumn(columnList0, "filter_name", "name"); mockColumn(columnList0, "filter_type", "type"); mockColumn(columnList0, "canary", false); mockColumn(columnList0, "application_name", "app_name"); when(response.getRowByIndex(0)).thenReturn(row0); Iterator<Row<String, String>> iterator = (Iterator<Row<String, String>>) mock(Iterator.class); when(response.iterator()).thenReturn(iterator); when(iterator.hasNext()).thenReturn(true, false); // 1 row when(iterator.next()).thenReturn(row0); when(response.isEmpty()).thenReturn(false); when(response.size()).thenReturn(1);
@SuppressWarnings(STR) void function() { String filter = STR; Calendar now = Calendar.getInstance(); Row<String, String> row0 = mockRow(); ColumnList<String> columnList0 = mockColumnList(row0); mockColumn(columnList0, STR, filter); mockColumn(columnList0, STR, 1L); mockColumn(columnList0, STR, false); mockColumn(columnList0, STR, now.getTime()); mockColumn(columnList0, STR, STR.getBytes()); mockColumn(columnList0, STR, "name"); mockColumn(columnList0, STR, "type"); mockColumn(columnList0, STR, false); mockColumn(columnList0, STR, STR); when(response.getRowByIndex(0)).thenReturn(row0); Iterator<Row<String, String>> iterator = (Iterator<Row<String, String>>) mock(Iterator.class); when(response.iterator()).thenReturn(iterator); when(iterator.hasNext()).thenReturn(true, false); when(iterator.next()).thenReturn(row0); when(response.isEmpty()).thenReturn(false); when(response.size()).thenReturn(1);
/** * Test that adding a script to an existing filter increases the revision number */
Test that adding a script to an existing filter increases the revision number
testAddScriptForExistingEndpoint
{ "repo_name": "yeungbo/zuul", "path": "zuul-netflix/src/main/java/com/netflix/zuul/scriptManager/ZuulFilterDAOCassandra.java", "license": "apache-2.0", "size": 73663 }
[ "com.netflix.astyanax.model.ColumnList", "com.netflix.astyanax.model.Row", "java.util.Calendar", "java.util.Iterator", "org.mockito.Mockito" ]
import com.netflix.astyanax.model.ColumnList; import com.netflix.astyanax.model.Row; import java.util.Calendar; import java.util.Iterator; import org.mockito.Mockito;
import com.netflix.astyanax.model.*; import java.util.*; import org.mockito.*;
[ "com.netflix.astyanax", "java.util", "org.mockito" ]
com.netflix.astyanax; java.util; org.mockito;
1,503,217
private void removeDeadFields(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof FieldDeclaration) { FieldDeclaration field = (FieldDeclaration) declaration; @SuppressWarnings("unchecked") Iterator<VariableDeclarationFragment> fragmentsIter = field.fragments().iterator(); while (fragmentsIter.hasNext()) { VariableDeclarationFragment fragment = fragmentsIter.next(); // Don't delete any constants because we can't detect their use. if (fragment.resolveBinding().getConstantValue() == null && deadCodeMap.isDeadField(clazz, fragment.getName().getIdentifier())) { fragmentsIter.remove(); } } if (field.fragments().isEmpty()) { declarationsIter.remove(); } } } }
void function(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof FieldDeclaration) { FieldDeclaration field = (FieldDeclaration) declaration; @SuppressWarnings(STR) Iterator<VariableDeclarationFragment> fragmentsIter = field.fragments().iterator(); while (fragmentsIter.hasNext()) { VariableDeclarationFragment fragment = fragmentsIter.next(); if (fragment.resolveBinding().getConstantValue() == null && deadCodeMap.isDeadField(clazz, fragment.getName().getIdentifier())) { fragmentsIter.remove(); } } if (field.fragments().isEmpty()) { declarationsIter.remove(); } } } }
/** * Deletes non-constant dead fields from a type's body declarations list. */
Deletes non-constant dead fields from a type's body declarations list
removeDeadFields
{ "repo_name": "rwl/j2objc", "path": "src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java", "license": "apache-2.0", "size": 34319 }
[ "java.util.Iterator", "java.util.List", "org.eclipse.jdt.core.dom.BodyDeclaration", "org.eclipse.jdt.core.dom.FieldDeclaration", "org.eclipse.jdt.core.dom.VariableDeclarationFragment" ]
import java.util.Iterator; import java.util.List; import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.FieldDeclaration; import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import java.util.*; import org.eclipse.jdt.core.dom.*;
[ "java.util", "org.eclipse.jdt" ]
java.util; org.eclipse.jdt;
280,806
protected void writeEntityToNBT(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInteger("TransferCooldown", this.transferTicker); tagCompound.setBoolean("Enabled", this.isBlocked); }
void function(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setInteger(STR, this.transferTicker); tagCompound.setBoolean(STR, this.isBlocked); }
/** * (abstract) Protected helper method to write subclass entity data to NBT. */
(abstract) Protected helper method to write subclass entity data to NBT
writeEntityToNBT
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/item/EntityMinecartHopper.java", "license": "gpl-3.0", "size": 6287 }
[ "net.minecraft.nbt.NBTTagCompound" ]
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.*;
[ "net.minecraft.nbt" ]
net.minecraft.nbt;
2,353,030
public @CheckForNull FilePath createPath(String absolutePath) { VirtualChannel ch = getChannel(); if(ch==null) return null; // offline return new FilePath(ch,absolutePath); }
@CheckForNull FilePath function(String absolutePath) { VirtualChannel ch = getChannel(); if(ch==null) return null; return new FilePath(ch,absolutePath); }
/** * Gets the {@link FilePath} on this node. */
Gets the <code>FilePath</code> on this node
createPath
{ "repo_name": "yannrouillard/pkg-jenkins", "path": "core/src/main/java/hudson/model/Node.java", "license": "mit", "size": 18072 }
[ "hudson.remoting.VirtualChannel", "javax.annotation.CheckForNull" ]
import hudson.remoting.VirtualChannel; import javax.annotation.CheckForNull;
import hudson.remoting.*; import javax.annotation.*;
[ "hudson.remoting", "javax.annotation" ]
hudson.remoting; javax.annotation;
1,609,756
@Override public void generateSet(JavaWriter out, String objThis, String value) throws IOException { out.println("if (" + value + " != null) {"); out.pushDepth(); AmberPersistenceUnit persistenceUnit = getOwnerType().getPersistenceUnit(); // ejb/06ie if (persistenceUnit.isJPA() && ! isEmbeddedId()) { // jpa/0u21 EmbeddableType embeddable = persistenceUnit.getEmbeddable(_tKeyClass.getName()); // jpa/0u21 ArrayList<IdField> keys = getKeys(); ArrayList<AmberField> keys = embeddable.getFields(); for (int i = 0; i < keys.size(); i++) { PropertyField key = (PropertyField) keys.get(i); String getter = "__caucho_get_field(" + i + ")"; String subValue = "((com.caucho.amber.entity.Embeddable) key)." + getter; out.println("Object field" + i + " = " + subValue + ";"); out.println("if (field" + i + " == null)"); out.println(" return;"); KeyPropertyField prop = null; AmberColumn column = key.getColumn(); // jpa/0j55 if (true || column == null) { ArrayList<IdField> fields = getKeys(); for (int j = 0; j < fields.size(); j++) { IdField id = fields.get(j); if (id.getName().equals(key.getName())) if (id instanceof KeyPropertyField) prop = (KeyPropertyField) id; } } if (prop != null) key = prop; AmberType columnType = key.getColumn().getType(); value = columnType.generateCastFromObject("field" + i); key.generateSet(out, objThis, value); } // jpa/0u21 // out.println("__caucho_compound_key = (" + getForeignTypeName() + ") " + value + ";"); } else { out.println(getForeignTypeName() + " " + value + "_key = (" + getForeignTypeName() + ") " + value + ";"); if (getEmbeddedIdField() == null) { // ejb/06ie ArrayList<IdField> keys = getKeys(); for (int i = 0; i < keys.size(); i++) { IdField key = keys.get(i); key.generateSet(out, objThis, key.generateGetKeyProperty(objThis + "_key")); } } else getEmbeddedIdField().generateSet(out, objThis, value + "_key"); } out.popDepth(); out.println("}"); }
void function(JavaWriter out, String objThis, String value) throws IOException { out.println(STR + value + STR); out.pushDepth(); AmberPersistenceUnit persistenceUnit = getOwnerType().getPersistenceUnit(); if (persistenceUnit.isJPA() && ! isEmbeddedId()) { EmbeddableType embeddable = persistenceUnit.getEmbeddable(_tKeyClass.getName()); ArrayList<AmberField> keys = embeddable.getFields(); for (int i = 0; i < keys.size(); i++) { PropertyField key = (PropertyField) keys.get(i); String getter = STR + i + ")"; String subValue = STR + getter; out.println(STR + i + STR + subValue + ";"); out.println(STR + i + STR); out.println(STR); KeyPropertyField prop = null; AmberColumn column = key.getColumn(); if (true column == null) { ArrayList<IdField> fields = getKeys(); for (int j = 0; j < fields.size(); j++) { IdField id = fields.get(j); if (id.getName().equals(key.getName())) if (id instanceof KeyPropertyField) prop = (KeyPropertyField) id; } } if (prop != null) key = prop; AmberType columnType = key.getColumn().getType(); value = columnType.generateCastFromObject("field" + i); key.generateSet(out, objThis, value); } } else { out.println(getForeignTypeName() + " " + value + STR + getForeignTypeName() + STR + value + ";"); if (getEmbeddedIdField() == null) { ArrayList<IdField> keys = getKeys(); for (int i = 0; i < keys.size(); i++) { IdField key = keys.get(i); key.generateSet(out, objThis, key.generateGetKeyProperty(objThis + "_key")); } } else getEmbeddedIdField().generateSet(out, objThis, value + "_key"); } out.popDepth(); out.println("}"); }
/** * Generates loading cache */
Generates loading cache
generateSet
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/amber/field/CompositeId.java", "license": "gpl-2.0", "size": 16710 }
[ "com.caucho.amber.manager.AmberPersistenceUnit", "com.caucho.amber.table.AmberColumn", "com.caucho.amber.type.AmberType", "com.caucho.amber.type.EmbeddableType", "com.caucho.java.JavaWriter", "java.io.IOException", "java.util.ArrayList" ]
import com.caucho.amber.manager.AmberPersistenceUnit; import com.caucho.amber.table.AmberColumn; import com.caucho.amber.type.AmberType; import com.caucho.amber.type.EmbeddableType; import com.caucho.java.JavaWriter; import java.io.IOException; import java.util.ArrayList;
import com.caucho.amber.manager.*; import com.caucho.amber.table.*; import com.caucho.amber.type.*; import com.caucho.java.*; import java.io.*; import java.util.*;
[ "com.caucho.amber", "com.caucho.java", "java.io", "java.util" ]
com.caucho.amber; com.caucho.java; java.io; java.util;
405,133
public AgentBuilder setDiscountFactor(DiscountFactor discountFactor) { this.discountFactor = discountFactor; this.qualityUpdater = new QualityUpdater(this.qualityMap, this.qualityUpdateStrategy, this.learningRate, discountFactor); return this; }
AgentBuilder function(DiscountFactor discountFactor) { this.discountFactor = discountFactor; this.qualityUpdater = new QualityUpdater(this.qualityMap, this.qualityUpdateStrategy, this.learningRate, discountFactor); return this; }
/** * Set the {@code DiscountFactor} that this builder will give to its resulting {@link Agent} to * control how it learns. * * @param discountFactor the {@code DiscountFactor} that the resulting {@code Agent} will use. * @return this builder, for chaining */
Set the DiscountFactor that this builder will give to its resulting <code>Agent</code> to control how it learns
setDiscountFactor
{ "repo_name": "Cantido/qlearner", "path": "src/main/java/io/github/cantido/qlearner/agent/AgentBuilder.java", "license": "gpl-3.0", "size": 9960 }
[ "io.github.cantido.qlearner.algorithm.model.DiscountFactor", "io.github.cantido.qlearner.algorithm.quality.QualityUpdater" ]
import io.github.cantido.qlearner.algorithm.model.DiscountFactor; import io.github.cantido.qlearner.algorithm.quality.QualityUpdater;
import io.github.cantido.qlearner.algorithm.model.*; import io.github.cantido.qlearner.algorithm.quality.*;
[ "io.github.cantido" ]
io.github.cantido;
2,292,126
@Override public void configure (WebAppContext context) throws Exception { //cannot configure if the _context is already started if (context.isStarted()) { LOG.debug("Cannot configure webapp after it is started"); return; } LOG.debug("Configuring web-jetty.xml"); Resource web_inf = context.getWebInf(); // handle any WEB-INF descriptors if(web_inf!=null&&web_inf.isDirectory()) { // do jetty.xml file Resource jetty=web_inf.addPath("jetty8-web.xml"); if(!jetty.exists()) jetty=web_inf.addPath(JETTY_WEB_XML); if(!jetty.exists()) jetty=web_inf.addPath("web-jetty.xml"); if(jetty.exists()) { // No server classes while configuring String[] old_server_classes = context.getServerClasses(); try { context.setServerClasses(null); if(LOG.isDebugEnabled()) LOG.debug("Configure: "+jetty); XmlConfiguration jetty_config = (XmlConfiguration)context.getAttribute(XML_CONFIGURATION); if (jetty_config==null) { jetty_config=new XmlConfiguration(jetty.getURL()); } else { context.removeAttribute(XML_CONFIGURATION); } setupXmlConfiguration(context,jetty_config, web_inf); try { jetty_config.configure(context); } catch (ClassNotFoundException e) { LOG.warn("Unable to process jetty-web.xml", e); } } finally { if (context.getServerClasses()==null) context.setServerClasses(old_server_classes); } } } }
void function (WebAppContext context) throws Exception { if (context.isStarted()) { LOG.debug(STR); return; } LOG.debug(STR); Resource web_inf = context.getWebInf(); if(web_inf!=null&&web_inf.isDirectory()) { Resource jetty=web_inf.addPath(STR); if(!jetty.exists()) jetty=web_inf.addPath(JETTY_WEB_XML); if(!jetty.exists()) jetty=web_inf.addPath(STR); if(jetty.exists()) { String[] old_server_classes = context.getServerClasses(); try { context.setServerClasses(null); if(LOG.isDebugEnabled()) LOG.debug(STR+jetty); XmlConfiguration jetty_config = (XmlConfiguration)context.getAttribute(XML_CONFIGURATION); if (jetty_config==null) { jetty_config=new XmlConfiguration(jetty.getURL()); } else { context.removeAttribute(XML_CONFIGURATION); } setupXmlConfiguration(context,jetty_config, web_inf); try { jetty_config.configure(context); } catch (ClassNotFoundException e) { LOG.warn(STR, e); } } finally { if (context.getServerClasses()==null) context.setServerClasses(old_server_classes); } } } }
/** * Configure * Apply web-jetty.xml configuration * @see Configuration#configure(WebAppContext) */
Configure Apply web-jetty.xml configuration
configure
{ "repo_name": "whiteley/jetty8", "path": "jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JettyWebXmlConfiguration.java", "license": "apache-2.0", "size": 5111 }
[ "org.eclipse.jetty.util.resource.Resource", "org.eclipse.jetty.xml.XmlConfiguration" ]
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.xml.XmlConfiguration;
import org.eclipse.jetty.util.resource.*; import org.eclipse.jetty.xml.*;
[ "org.eclipse.jetty" ]
org.eclipse.jetty;
2,675,547
@Override public void onOpen(WebSocket conn, ClientHandshake handshake) { conns.add(conn); System.out.println("New connection from " + conn.getRemoteSocketAddress().getAddress().getHostAddress()); }
void function(WebSocket conn, ClientHandshake handshake) { conns.add(conn); System.out.println(STR + conn.getRemoteSocketAddress().getAddress().getHostAddress()); }
/** * Method handler when a new connection has been opened. */
Method handler when a new connection has been opened
onOpen
{ "repo_name": "Screenful/screenful-gestures", "path": "server/Screenful-GestureServer/src/screenful/server/GestureServer.java", "license": "mit", "size": 6433 }
[ "org.java_websocket.WebSocket", "org.java_websocket.handshake.ClientHandshake" ]
import org.java_websocket.WebSocket; import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.*; import org.java_websocket.handshake.*;
[ "org.java_websocket", "org.java_websocket.handshake" ]
org.java_websocket; org.java_websocket.handshake;
2,217,208
Integer insertAndReturnKey(ProjectRole value);
Integer insertAndReturnKey(ProjectRole value);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_role * * @mbggenerated Mon Sep 21 13:52:03 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_role
insertAndReturnKey
{ "repo_name": "maduhu/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/ProjectRoleMapper.java", "license": "agpl-3.0", "size": 5550 }
[ "com.esofthead.mycollab.module.project.domain.ProjectRole" ]
import com.esofthead.mycollab.module.project.domain.ProjectRole;
import com.esofthead.mycollab.module.project.domain.*;
[ "com.esofthead.mycollab" ]
com.esofthead.mycollab;
566,654
public static Integer getSarlClassification(ProgramElementDoc type) { final AnnotationDesc annotation = Utils.findFirst(type.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlElementTypeAnnotationName())); if (annotation != null) { final ElementValuePair[] pairs = annotation.elementValues(); if (pairs != null && pairs.length > 0) { return ((Number) pairs[0].value().value()).intValue(); } } return null; }
static Integer function(ProgramElementDoc type) { final AnnotationDesc annotation = Utils.findFirst(type.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlElementTypeAnnotationName())); if (annotation != null) { final ElementValuePair[] pairs = annotation.elementValues(); if (pairs != null && pairs.length > 0) { return ((Number) pairs[0].value().value()).intValue(); } } return null; }
/** Replies the SARL element type of the given type. * * @param type the type. * @return the SARL element type, or {@code null} if unknown. */
Replies the SARL element type of the given type
getSarlClassification
{ "repo_name": "sarl/sarl", "path": "docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java", "license": "apache-2.0", "size": 15141 }
[ "com.sun.javadoc.AnnotationDesc", "com.sun.javadoc.ProgramElementDoc" ]
import com.sun.javadoc.AnnotationDesc; import com.sun.javadoc.ProgramElementDoc;
import com.sun.javadoc.*;
[ "com.sun.javadoc" ]
com.sun.javadoc;
362,181
public static <S extends Storable> Comparator<S> createComparator(OrderedProperty<S>... properties) { if (properties == null || properties.length == 0 || properties[0] == null) { throw new IllegalArgumentException(); } Class<S> type = properties[0].getChainedProperty().getPrimeProperty().getEnclosingType(); BeanComparator bc = BeanComparator.forClass(type); for (OrderedProperty<S> property : properties) { if (property == null) { throw new IllegalArgumentException(); } bc = orderBy(bc, property); } return bc; }
static <S extends Storable> Comparator<S> function(OrderedProperty<S>... properties) { if (properties == null properties.length == 0 properties[0] == null) { throw new IllegalArgumentException(); } Class<S> type = properties[0].getChainedProperty().getPrimeProperty().getEnclosingType(); BeanComparator bc = BeanComparator.forClass(type); for (OrderedProperty<S> property : properties) { if (property == null) { throw new IllegalArgumentException(); } bc = orderBy(bc, property); } return bc; }
/** * Convenience method to create a comparator which orders storables by the * given properties. * * @param properties list of properties to order by * @throws IllegalArgumentException if no properties or if any property is null */
Convenience method to create a comparator which orders storables by the given properties
createComparator
{ "repo_name": "Carbonado/Carbonado", "path": "src/main/java/com/amazon/carbonado/cursor/SortedCursor.java", "license": "apache-2.0", "size": 15364 }
[ "com.amazon.carbonado.Storable", "com.amazon.carbonado.info.OrderedProperty", "java.util.Comparator", "org.cojen.util.BeanComparator" ]
import com.amazon.carbonado.Storable; import com.amazon.carbonado.info.OrderedProperty; import java.util.Comparator; import org.cojen.util.BeanComparator;
import com.amazon.carbonado.*; import com.amazon.carbonado.info.*; import java.util.*; import org.cojen.util.*;
[ "com.amazon.carbonado", "java.util", "org.cojen.util" ]
com.amazon.carbonado; java.util; org.cojen.util;
2,077,405
void setProgress(Integer progress); /** * Gets the detailed message related to the {@link NotifyStatus} * * @return The detailed message related to the {@link NotifyStatus}
void setProgress(Integer progress); /** * Gets the detailed message related to the {@link NotifyStatus} * * @return The detailed message related to the {@link NotifyStatus}
/** * Sets the progress percentage of the processing. * * @param progress The progress percentage of the processing. * @since 1.0.0 */
Sets the progress percentage of the processing
setProgress
{ "repo_name": "stzilli/kapua", "path": "service/device/management/registry/api/src/main/java/org/eclipse/kapua/service/device/management/registry/operation/notification/ManagementOperationNotification.java", "license": "epl-1.0", "size": 4716 }
[ "org.eclipse.kapua.service.device.management.message.notification.NotifyStatus" ]
import org.eclipse.kapua.service.device.management.message.notification.NotifyStatus;
import org.eclipse.kapua.service.device.management.message.notification.*;
[ "org.eclipse.kapua" ]
org.eclipse.kapua;
2,633,481
@LargeTest public void testSearchManagerAvailable() { SearchManager searchManager1 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager1); SearchManager searchManager2 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager2); assertSame(searchManager1, searchManager2 ); }
void function() { SearchManager searchManager1 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager1); SearchManager searchManager2 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); assertNotNull(searchManager2); assertSame(searchManager1, searchManager2 ); }
/** * The goal of this test is to confirm that we can obtain * a search manager at any time, and that for any given context, * it is a singleton. */
The goal of this test is to confirm that we can obtain a search manager at any time, and that for any given context, it is a singleton
testSearchManagerAvailable
{ "repo_name": "JuudeDemos/android-sdk-20", "path": "src/android/app/SearchManagerTest.java", "license": "apache-2.0", "size": 6030 }
[ "android.app.SearchManager", "android.content.Context" ]
import android.app.SearchManager; import android.content.Context;
import android.app.*; import android.content.*;
[ "android.app", "android.content" ]
android.app; android.content;
1,489,701
public synchronized void checkTGTAndReloginFromKeytab() throws IOException { //TODO: The method reloginFromKeytab should be refactored to use this // implementation. if (!isSecurityEnabled() || user.getAuthenticationMethod() != AuthenticationMethod.KERBEROS || !isKeytab) return; KerberosTicket tgt = getTGT(); if (tgt != null && System.currentTimeMillis() < getRefreshTime(tgt)) { return; } reloginFromKeytab(); }
synchronized void function() throws IOException { if (!isSecurityEnabled() user.getAuthenticationMethod() != AuthenticationMethod.KERBEROS !isKeytab) return; KerberosTicket tgt = getTGT(); if (tgt != null && System.currentTimeMillis() < getRefreshTime(tgt)) { return; } reloginFromKeytab(); }
/** * Re-login a user from keytab if TGT is expired or is close to expiry. * * @throws java.io.IOException */
Re-login a user from keytab if TGT is expired or is close to expiry
checkTGTAndReloginFromKeytab
{ "repo_name": "oscerd/servicemix-bundles", "path": "hadoop-core-1.2.1/src/main/java/org/apache/hadoop/security/UserGroupInformation.java", "license": "apache-2.0", "size": 38436 }
[ "java.io.IOException", "javax.security.auth.kerberos.KerberosTicket" ]
import java.io.IOException; import javax.security.auth.kerberos.KerberosTicket;
import java.io.*; import javax.security.auth.kerberos.*;
[ "java.io", "javax.security" ]
java.io; javax.security;
541,272
public static Db fromTDatabase(TDatabase db, Catalog parentCatalog) { return new Db(db.getDb_name(), parentCatalog); } public boolean isSystemDb() { return isSystemDb_; }
static Db function(TDatabase db, Catalog parentCatalog) { return new Db(db.getDb_name(), parentCatalog); } public boolean isSystemDb() { return isSystemDb_; }
/** * Creates a Db object with no tables based on the given TDatabase thrift struct. */
Creates a Db object with no tables based on the given TDatabase thrift struct
fromTDatabase
{ "repo_name": "AtScaleInc/Impala", "path": "fe/src/main/java/com/cloudera/impala/catalog/Db.java", "license": "apache-2.0", "size": 9786 }
[ "com.cloudera.impala.thrift.TDatabase" ]
import com.cloudera.impala.thrift.TDatabase;
import com.cloudera.impala.thrift.*;
[ "com.cloudera.impala" ]
com.cloudera.impala;
588,342
final Iterator<IntervalList> iterator = new IntervalListScatter(this, inputList, scatterCount).iterator(); final ArrayList<IntervalList> intervalLists = new ArrayList<>(); iterator.forEachRemaining(intervalLists::add); return intervalLists; } /** * A function that will be called on an IntervalList prior to splitting it into sub-lists, and is a point where * implementations can chose to impose some conditions on the lists, for example, merging overlapping/abutting intervals, * removing duplicates, etc. * @param inputList the original {@link IntervalList}
final Iterator<IntervalList> iterator = new IntervalListScatter(this, inputList, scatterCount).iterator(); final ArrayList<IntervalList> intervalLists = new ArrayList<>(); iterator.forEachRemaining(intervalLists::add); return intervalLists; } /** * A function that will be called on an IntervalList prior to splitting it into sub-lists, and is a point where * implementations can chose to impose some conditions on the lists, for example, merging overlapping/abutting intervals, * removing duplicates, etc. * @param inputList the original {@link IntervalList}
/** * Scatter an {@link IntervalList} into several IntervalLists. The default implementation * makes use of the other interfaced methods, and aims to provide a universal way to * scatter an IntervalList. * * @param inputList IntervalList to be scattered * @param scatterCount ideal number of scatters generated. * @return Scattered {@link List} of IntervalLists, */
Scatter an <code>IntervalList</code> into several IntervalLists. The default implementation makes use of the other interfaced methods, and aims to provide a universal way to scatter an IntervalList
scatter
{ "repo_name": "broadinstitute/picard", "path": "src/main/java/picard/util/IntervalList/IntervalListScatterer.java", "license": "mit", "size": 4289 }
[ "java.util.ArrayList", "java.util.Iterator" ]
import java.util.ArrayList; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,128,064
public static Action planAction(WorldModel worldModel, Goal goal, Func1<WorldModel, Double> heuristic, int maxDepth) { double cutoff = heuristic.invoke(worldModel); TranspositionTable transpositionTable = new TranspositionTable(); while (cutoff >= 0) { CutoffAction ca = depthFirst(worldModel, goal, transpositionTable, heuristic, maxDepth, cutoff); if (ca.action != null) { return ca.action; } cutoff = ca.cutoff; } return null; }
static Action function(WorldModel worldModel, Goal goal, Func1<WorldModel, Double> heuristic, int maxDepth) { double cutoff = heuristic.invoke(worldModel); TranspositionTable transpositionTable = new TranspositionTable(); while (cutoff >= 0) { CutoffAction ca = depthFirst(worldModel, goal, transpositionTable, heuristic, maxDepth, cutoff); if (ca.action != null) { return ca.action; } cutoff = ca.cutoff; } return null; }
/** * Execute the planning for the given goal. * @param worldModel the starting world model * @param goal the goal * @param heuristic the cost heuristic * @param maxDepth the maximum search depth * @return the action to take or null if no action available */
Execute the planning for the given goal
planAction
{ "repo_name": "p-smith/open-ig", "path": "src/hu/openig/tools/IDAStarGOAP.java", "license": "lgpl-3.0", "size": 5826 }
[ "hu.openig.core.Func1" ]
import hu.openig.core.Func1;
import hu.openig.core.*;
[ "hu.openig.core" ]
hu.openig.core;
784,201
@Test(timeout=5000) public void testSimpleRosterInitialization() throws Exception { // Setup final Roster roster = connection.getRoster(); assertNotNull("Can't get the roster from the provided connection!", roster); assertFalse("Roster shouldn't be already initialized!", roster.rosterInitialized); // Perform roster initialization initRoster(connection, roster); // Verify roster assertTrue("Roster can't be initialized!", roster.rosterInitialized); verifyRomeosEntry(roster.getEntry("romeo@example.net")); verifyMercutiosEntry(roster.getEntry("mercutio@example.com")); verifyBenvoliosEntry(roster.getEntry("benvolio@example.net")); assertSame("Wrong number of roster entries.", 3, roster.getEntries().size()); // Verify roster listener assertTrue("The roster listener wasn't invoked for Romeo.", rosterListener.getAddedAddresses().contains("romeo@example.net")); assertTrue("The roster listener wasn't invoked for Mercutio.", rosterListener.getAddedAddresses().contains("mercutio@example.com")); assertTrue("The roster listener wasn't invoked for Benvolio.", rosterListener.getAddedAddresses().contains("benvolio@example.net")); assertSame("RosterListeners implies that a item was deleted!", 0, rosterListener.getDeletedAddresses().size()); assertSame("RosterListeners implies that a item was updated!", 0, rosterListener.getUpdatedAddresses().size()); }
@Test(timeout=5000) void function() throws Exception { final Roster roster = connection.getRoster(); assertNotNull(STR, roster); assertFalse(STR, roster.rosterInitialized); initRoster(connection, roster); assertTrue(STR, roster.rosterInitialized); verifyRomeosEntry(roster.getEntry(STR)); verifyMercutiosEntry(roster.getEntry(STR)); verifyBenvoliosEntry(roster.getEntry(STR)); assertSame(STR, 3, roster.getEntries().size()); assertTrue(STR, rosterListener.getAddedAddresses().contains(STR)); assertTrue(STR, rosterListener.getAddedAddresses().contains(STR)); assertTrue(STR, rosterListener.getAddedAddresses().contains(STR)); assertSame(STR, 0, rosterListener.getDeletedAddresses().size()); assertSame(STR, 0, rosterListener.getUpdatedAddresses().size()); }
/** * Test a simple roster initialization according to the example in * <a href="http://xmpp.org/rfcs/rfc3921.html#roster-login" * >RFC3921: Retrieving One's Roster on Login</a>. */
Test a simple roster initialization according to the example in RFC3921: Retrieving One's Roster on Login
testSimpleRosterInitialization
{ "repo_name": "vito-c/Smack", "path": "smack-core/src/test/java/org/jivesoftware/smack/RosterTest.java", "license": "apache-2.0", "size": 32878 }
[ "org.junit.Assert", "org.junit.Test" ]
import org.junit.Assert; import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,587,073
public void init(byte[] P) { try { mac.init(new SecretKeySpec(P, macAlgorithm)); } catch (InvalidKeyException e) { throw new RuntimeException(e); } }
void function(byte[] P) { try { mac.init(new SecretKeySpec(P, macAlgorithm)); } catch (InvalidKeyException e) { throw new RuntimeException(e); } }
/** * Method init. * * @param P byte[] * * @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[]) */
Method init
init
{ "repo_name": "sgdc3/AuthMeReloaded", "path": "src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java", "license": "gpl-3.0", "size": 3321 }
[ "java.security.InvalidKeyException", "javax.crypto.spec.SecretKeySpec" ]
import java.security.InvalidKeyException; import javax.crypto.spec.SecretKeySpec;
import java.security.*; import javax.crypto.spec.*;
[ "java.security", "javax.crypto" ]
java.security; javax.crypto;
2,142,824
public CosmosPagedFlux<CosmosConflictProperties> queryConflicts(String query, CosmosQueryRequestOptions options) { final CosmosQueryRequestOptions requestOptions = options == null ? new CosmosQueryRequestOptions() : options; return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { pagedFluxOptions.setTracerInformation(this.getDatabase().getClient().getTracerProvider(), this.queryConflictsSpanName, this.getDatabase().getClient().getServiceEndpoint(), database.getId()); setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); return database.getDocClientWrapper().queryConflicts(getLink(), query, requestOptions) .map(response -> BridgeInternal.createFeedResponse( ModelBridgeInternal.getCosmosConflictPropertiesFromV2Results(response.getResults()), response.getResponseHeaders())); }); }
CosmosPagedFlux<CosmosConflictProperties> function(String query, CosmosQueryRequestOptions options) { final CosmosQueryRequestOptions requestOptions = options == null ? new CosmosQueryRequestOptions() : options; return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { pagedFluxOptions.setTracerInformation(this.getDatabase().getClient().getTracerProvider(), this.queryConflictsSpanName, this.getDatabase().getClient().getServiceEndpoint(), database.getId()); setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); return database.getDocClientWrapper().queryConflicts(getLink(), query, requestOptions) .map(response -> BridgeInternal.createFeedResponse( ModelBridgeInternal.getCosmosConflictPropertiesFromV2Results(response.getResults()), response.getResponseHeaders())); }); }
/** * Queries all the conflicts in the current container. * * @param query the query. * @param options the query request options. * @return a {@link CosmosPagedFlux} containing one or several feed response pages of the * obtained conflicts or an error. */
Queries all the conflicts in the current container
queryConflicts
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java", "license": "mit", "size": 47776 }
[ "com.azure.cosmos.implementation.Utils", "com.azure.cosmos.models.CosmosConflictProperties", "com.azure.cosmos.models.CosmosQueryRequestOptions", "com.azure.cosmos.models.ModelBridgeInternal", "com.azure.cosmos.util.CosmosPagedFlux", "com.azure.cosmos.util.UtilBridgeInternal" ]
import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.models.CosmosConflictProperties; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.util.CosmosPagedFlux; import com.azure.cosmos.util.UtilBridgeInternal;
import com.azure.cosmos.implementation.*; import com.azure.cosmos.models.*; import com.azure.cosmos.util.*;
[ "com.azure.cosmos" ]
com.azure.cosmos;
1,013,307
public double getMaxValue(Variable variable) throws MotuException, NetCdfVariableException { MAMath.MinMax minMax = getMinMaxValue(variable); return minMax.max; }
double function(Variable variable) throws MotuException, NetCdfVariableException { MAMath.MinMax minMax = getMinMaxValue(variable); return minMax.max; }
/** * Gets the min. value of a variable data. First search the min. value in 'valid_min' attribute of the * variable, if attribute doesn't exist, calculate the min. value from variable data. * * @param variable whose min. value has to be calculated * @return the min value of the variable data * @throws MotuException the motu exception * @throws NetCdfVariableException the net cdf variable exception */
Gets the min. value of a variable data. First search the min. value in 'valid_min' attribute of the variable, if attribute doesn't exist, calculate the min. value from variable data
getMaxValue
{ "repo_name": "clstoulouse/motu", "path": "motu-web/src/main/java/fr/cls/atoll/motu/web/dal/request/netcdf/data/Product.java", "license": "lgpl-3.0", "size": 46814 }
[ "fr.cls.atoll.motu.web.bll.exception.MotuException", "fr.cls.atoll.motu.web.bll.exception.NetCdfVariableException" ]
import fr.cls.atoll.motu.web.bll.exception.MotuException; import fr.cls.atoll.motu.web.bll.exception.NetCdfVariableException;
import fr.cls.atoll.motu.web.bll.exception.*;
[ "fr.cls.atoll" ]
fr.cls.atoll;
2,178,163
//#ifdef JAVA4 public synchronized void setBoolean(String parameterName, boolean x) throws SQLException { setBoolean(findParameterIndex(parameterName), x); } //#endif JAVA4
synchronized void function(String parameterName, boolean x) throws SQLException { setBoolean(findParameterIndex(parameterName), x); }
/** * <!-- start generic documentation --> * * Sets the designated parameter to the given Java <code>boolean</code> value. * * <p>(JDBC4 clarification:)<p> * * The driver converts this * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database. * * <!-- end generic documentation --> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB supports this feature. <p> * </div> * <!-- end release-specific documentation --> * * @param parameterName the name of the parameter * @param x the parameter value * @exception SQLException if a database access error occurs or * this method is called on a closed <code>CallableStatement</code> * @see #getBoolean * @exception SQLFeatureNotSupportedException if the JDBC driver does not support * this method * @see #getBoolean * @since JDK 1.4, HSQLDB 1.7.0 */
Sets the designated parameter to the given Java <code>boolean</code> value. (JDBC4 clarification:) The driver converts this to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database. HSQLDB-Specific Information: HSQLDB supports this feature.
setBoolean
{ "repo_name": "malin1993ml/h-store", "path": "src/hsqldb19b3/org/hsqldb/jdbc/JDBCCallableStatement.java", "license": "gpl-3.0", "size": 186064 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,343,331