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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
EList<ConceptualScenarioMetaModel.Exception> getExceptions();
EList<ConceptualScenarioMetaModel.Exception> getExceptions();
/** * Returns the value of the '<em><b>Exceptions</b></em>' containment reference list. * The list contents are of type {@link ConceptualScenarioMetaModel.Exception}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Exceptions</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Exceptions</em>' containment reference list. * @see ConceptualScenarioMetaModel.ConceptualScenarioMetaModelPackage#getPatternAction_Exceptions() * @model containment="true" * @generated */
Returns the value of the 'Exceptions' containment reference list. The list contents are of type <code>ConceptualScenarioMetaModel.Exception</code>. If the meaning of the 'Exceptions' containment reference list isn't clear, there really should be more of a description here...
getExceptions
{ "repo_name": "umutdurak/MDSceE", "path": "ConceptualScenarioMetaModel/src/ConceptualScenarioMetaModel/PatternAction.java", "license": "mit", "size": 6290 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,926,466
public String doModifyAccountLifeTimeEmails( HttpServletRequest request ) throws AccessDeniedException { if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_MODIFY_ACCOUNT_LIFE_TIME_EMAIL ) ) { throw new AccessDeniedException( ERROR_INVALID_TOKEN ); } String strEmailType = request.getParameter( PARAMETER_EMAIL_TYPE ); String strSenderKey = StringUtils.EMPTY; String strSubjectKey = StringUtils.EMPTY; String strBodyKey = StringUtils.EMPTY; if ( CONSTANT_EMAIL_TYPE_FIRST.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_FIRST_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_FIRST_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_FIRST_ALERT_MAIL; } else if ( CONSTANT_EMAIL_TYPE_OTHER.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_OTHER_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_OTHER_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_OTHER_ALERT_MAIL; } else if ( CONSTANT_EMAIL_TYPE_EXPIRED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_EXPIRED_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_EXPIRED_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_EXPIRATION_MAIL; } else if ( CONSTANT_EMAIL_TYPE_REACTIVATED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_REACTIVATED_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_REACTIVATED_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_ACCOUNT_REACTIVATED; } else if ( CONSTANT_EMAIL_PASSWORD_EXPIRED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_PASSWORD_EXPIRED_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_PASSWORD_EXPIRED_MAIL_SUBJECT; strBodyKey = PARAMETER_NOTIFY_PASSWORD_EXPIRED; } AdminUserService.updateSecurityParameter( strSenderKey, request.getParameter( MARK_EMAIL_SENDER ) ); AdminUserService.updateSecurityParameter( strSubjectKey, request.getParameter( MARK_EMAIL_SUBJECT ) ); DatabaseTemplateService.updateTemplate( strBodyKey, request.getParameter( MARK_EMAIL_BODY ) ); return JSP_MANAGE_ADVANCED_PARAMETERS; }
String function( HttpServletRequest request ) throws AccessDeniedException { if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_MODIFY_ACCOUNT_LIFE_TIME_EMAIL ) ) { throw new AccessDeniedException( ERROR_INVALID_TOKEN ); } String strEmailType = request.getParameter( PARAMETER_EMAIL_TYPE ); String strSenderKey = StringUtils.EMPTY; String strSubjectKey = StringUtils.EMPTY; String strBodyKey = StringUtils.EMPTY; if ( CONSTANT_EMAIL_TYPE_FIRST.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_FIRST_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_FIRST_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_FIRST_ALERT_MAIL; } else if ( CONSTANT_EMAIL_TYPE_OTHER.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_OTHER_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_OTHER_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_OTHER_ALERT_MAIL; } else if ( CONSTANT_EMAIL_TYPE_EXPIRED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_EXPIRED_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_EXPIRED_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_EXPIRATION_MAIL; } else if ( CONSTANT_EMAIL_TYPE_REACTIVATED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_REACTIVATED_ALERT_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_REACTIVATED_ALERT_MAIL_SUBJECT; strBodyKey = PARAMETER_ACCOUNT_REACTIVATED; } else if ( CONSTANT_EMAIL_PASSWORD_EXPIRED.equalsIgnoreCase( strEmailType ) ) { strSenderKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_PASSWORD_EXPIRED_MAIL_SENDER; strSubjectKey = CONSTANT_ADVANCED_PARAMS + PARAMETER_PASSWORD_EXPIRED_MAIL_SUBJECT; strBodyKey = PARAMETER_NOTIFY_PASSWORD_EXPIRED; } AdminUserService.updateSecurityParameter( strSenderKey, request.getParameter( MARK_EMAIL_SENDER ) ); AdminUserService.updateSecurityParameter( strSubjectKey, request.getParameter( MARK_EMAIL_SUBJECT ) ); DatabaseTemplateService.updateTemplate( strBodyKey, request.getParameter( MARK_EMAIL_BODY ) ); return JSP_MANAGE_ADVANCED_PARAMETERS; }
/** * Update an account life time email * * @param request * The request * @return The Jsp URL of the process result * @throws AccessDeniedException * if the security token is invalid */
Update an account life time email
doModifyAccountLifeTimeEmails
{ "repo_name": "rzara/lutece-core", "path": "src/java/fr/paris/lutece/portal/web/user/AdminUserJspBean.java", "license": "bsd-3-clause", "size": 121999 }
[ "fr.paris.lutece.portal.service.admin.AccessDeniedException", "fr.paris.lutece.portal.service.admin.AdminUserService", "fr.paris.lutece.portal.service.security.SecurityTokenService", "fr.paris.lutece.portal.service.template.DatabaseTemplateService", "javax.servlet.http.HttpServletRequest", "org.apache.commons.lang.StringUtils" ]
import fr.paris.lutece.portal.service.admin.AccessDeniedException; import fr.paris.lutece.portal.service.admin.AdminUserService; import fr.paris.lutece.portal.service.security.SecurityTokenService; import fr.paris.lutece.portal.service.template.DatabaseTemplateService; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils;
import fr.paris.lutece.portal.service.admin.*; import fr.paris.lutece.portal.service.security.*; import fr.paris.lutece.portal.service.template.*; import javax.servlet.http.*; import org.apache.commons.lang.*;
[ "fr.paris.lutece", "javax.servlet", "org.apache.commons" ]
fr.paris.lutece; javax.servlet; org.apache.commons;
2,040,998
@WebMethod(operationName = "getGroups") @XmlElementWrapper(name = "groups", required = true) @XmlElement(name = "group", required = false) @WebResult(name = "groups") @Cacheable(value= Group.Cache.NAME, key="'ids=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)") List<Group> getGroups(@WebParam(name="ids") Collection<String> ids) throws RiceIllegalArgumentException;
@WebMethod(operationName = STR) @XmlElementWrapper(name = STR, required = true) @XmlElement(name = "group", required = false) @WebResult(name = STR) @Cacheable(value= Group.Cache.NAME, key=STR) List<Group> getGroups(@WebParam(name="ids") Collection<String> ids) throws RiceIllegalArgumentException;
/** * Gets all groups for the given collection of group ids. * * <p>The result is a Map containing the group id as the key and the Group as the value.</p> * * @param ids Collection that matches the desired Groups' id * @return a Map of Groups with the given id values. An empty Map is returned if an invalid or * non-existant id is supplied. * @throws RiceIllegalArgumentException if the groupIds null or empty */
Gets all groups for the given collection of group ids. The result is a Map containing the group id as the key and the Group as the value
getGroups
{ "repo_name": "ricepanda/rice-git2", "path": "rice-middleware/kim/kim-api/src/main/java/org/kuali/rice/kim/api/group/GroupService.java", "license": "apache-2.0", "size": 32747 }
[ "java.util.Collection", "java.util.List", "javax.jws.WebMethod", "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.bind.annotation.XmlElement", "javax.xml.bind.annotation.XmlElementWrapper", "org.kuali.rice.core.api.exception.RiceIllegalArgumentException", "org.springframework.cache.annotation.Cacheable" ]
import java.util.Collection; import java.util.List; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; import org.springframework.cache.annotation.Cacheable;
import java.util.*; import javax.jws.*; import javax.xml.bind.annotation.*; import org.kuali.rice.core.api.exception.*; import org.springframework.cache.annotation.*;
[ "java.util", "javax.jws", "javax.xml", "org.kuali.rice", "org.springframework.cache" ]
java.util; javax.jws; javax.xml; org.kuali.rice; org.springframework.cache;
726,059
public void setFooter (FooterRecord newFooter) { _footer = newFooter; }
void function (FooterRecord newFooter) { _footer = newFooter; }
/** * Sets the FooterRecord. * @param newFooter The new FooterRecord for the sheet. */
Sets the FooterRecord
setFooter
{ "repo_name": "tobyclemson/msci-project", "path": "vendor/poi-3.6/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java", "license": "mit", "size": 19208 }
[ "org.apache.poi.hssf.record.FooterRecord" ]
import org.apache.poi.hssf.record.FooterRecord;
import org.apache.poi.hssf.record.*;
[ "org.apache.poi" ]
org.apache.poi;
2,263,317
EClass getMissionExtendable();
EClass getMissionExtendable();
/** * Returns the meta object for class '{@link gov.nasa.ensemble.common.mission.MissionExtendable <em>Mission Extendable</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Mission Extendable</em>'. * @see gov.nasa.ensemble.common.mission.MissionExtendable * @model instanceClass="gov.nasa.ensemble.common.mission.MissionExtendable" * @generated */
Returns the meta object for class '<code>gov.nasa.ensemble.common.mission.MissionExtendable Mission Extendable</code>'.
getMissionExtendable
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.ensemble.emf/src/gov/nasa/ensemble/emf/model/common/CommonPackage.java", "license": "apache-2.0", "size": 12509 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,010,226
private void setSize(int sz) { putInt(baseAddr + MAPSIZE_OFFSET, sz); }
void function(int sz) { putInt(baseAddr + MAPSIZE_OFFSET, sz); }
/** * Changes collection size. * * @param sz new size to set. */
Changes collection size
setSize
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/RobinHoodBackwardShiftHashMap.java", "license": "apache-2.0", "size": 22406 }
[ "org.apache.ignite.internal.util.GridUnsafe" ]
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.*;
[ "org.apache.ignite" ]
org.apache.ignite;
793,326
private void triggerNotifications(final Treatment treatment) { // Create notification which is repeated AlarmManager alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(getActivity(), TreatmentBroadcastReceiver.class); intent.putExtra("treatment", treatment); PendingIntent alarmIntent = PendingIntent.getBroadcast(getActivity().getApplicationContext(), 0, intent, 0); Date startDate = treatment.getDate(); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, startDate.getTime(), treatment.getFrequency() * MILLISECONDS_PER_HOUR, alarmIntent);
void function(final Treatment treatment) { AlarmManager alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(getActivity(), TreatmentBroadcastReceiver.class); intent.putExtra(STR, treatment); PendingIntent alarmIntent = PendingIntent.getBroadcast(getActivity().getApplicationContext(), 0, intent, 0); Date startDate = treatment.getDate(); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, startDate.getTime(), treatment.getFrequency() * MILLISECONDS_PER_HOUR, alarmIntent);
/** * Create two notifications : * one that appears 10 seconds after adding the treatment, * and one that is repeated for each taking of the medicine. * @param treatment the treatment recalled in notifications */
Create two notifications : one that appears 10 seconds after adding the treatment, and one that is repeated for each taking of the medicine
triggerNotifications
{ "repo_name": "JonathanGeoffroy/LifeMonitor", "path": "app/src/main/java/lifemonitor/application/controller/medicalRecord/AddTreatmentActivity.java", "license": "gpl-2.0", "size": 17154 }
[ "android.app.AlarmManager", "android.app.PendingIntent", "android.content.Context", "android.content.Intent", "java.util.Date" ]
import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import java.util.Date;
import android.app.*; import android.content.*; import java.util.*;
[ "android.app", "android.content", "java.util" ]
android.app; android.content; java.util;
941,174
protected List<Long> computeIteratorKeys() { final List<Long> keys = new ArrayList<>(); final long len = length(); for (long i = 0L; i < len; i = nextIndex(i)) { if (has((int)i)) { keys.add(i); } } return keys; }
List<Long> function() { final List<Long> keys = new ArrayList<>(); final long len = length(); for (long i = 0L; i < len; i = nextIndex(i)) { if (has((int)i)) { keys.add(i); } } return keys; }
/** * Return a list of keys in the array for the iterators * @return iterator key list */
Return a list of keys in the array for the iterators
computeIteratorKeys
{ "repo_name": "lizhekang/TCJDK", "path": "sources/openjdk8/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java", "license": "gpl-2.0", "size": 28018 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,616,890
@Test public void ALF_5026() { testName = getTestName(); String testUser = getUserNameFreeDomain(testName + "1"); String siteName = getSiteName(testName); AdvanceSearchPage contentSearchPage; // Searching and sorting the content items List<String> searchInfo = Arrays.asList(ADV_CONTENT_SEARCH); String searchTerm = siteName + "_test"; try { ShareUser.login(drone, testUser, testPassword); ShareUser.openSitesDocumentLibrary(drone, siteName); ShareUserSitePage.selectView(drone, ViewType.SIMPLE_VIEW); // Modifying the 1st content and folder. ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + "_test1")); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + "_testing1")); webDriverWait(drone,70000); // Modifying 3rd content and folder. ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + "_test3")); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + "_testing3")); // Navigating to Advance search page. contentSearchPage = ShareUserSearchPage.navigateToAdvanceSearch(drone, searchInfo); // Searching with keyword contentSearchPage.inputKeyword(searchTerm); SearchResultsPage searchResultsPage = ShareUserSearchPage.clickSearchOnAdvanceSearch(drone); // Sorting results by Modified List<SearchResultItem> resultsList = ShareUserSearchPage.sortSearchResults(drone, SortType.MODIFIED); Assert.assertEquals(resultsList.get(0).getTitle(), searchTerm + "3"); Assert.assertEquals(resultsList.get(1).getTitle(), searchTerm + "1"); Assert.assertEquals(resultsList.get(2).getTitle(), searchTerm + "2"); // Searching and sorting the folders searchInfo = Arrays.asList(ADV_FOLDER_SEARCH, "searchAllSitesFromMyDashBoard"); searchTerm = siteName + "_testing"; // Navigating back to Advance search page. contentSearchPage = ShareUserSearchPage.navigateToAdvanceSearch(drone, searchInfo); // Searching with keyword contentSearchPage.inputKeyword(searchTerm); searchResultsPage = ShareUserSearchPage.clickSearchOnAdvanceSearch(drone); // Sorting results by Modified resultsList = ShareUserSearchPage.sortSearchResults(drone, SortType.MODIFIED); Assert.assertEquals(resultsList.get(0).getTitle(), searchTerm + "3"); Assert.assertEquals(resultsList.get(1).getTitle(), searchTerm + "1"); Assert.assertEquals(resultsList.get(2).getTitle(), searchTerm + "2"); } catch (Throwable e) { reportError(drone, testName, e); } finally { testCleanup(drone, testName); } }
void function() { testName = getTestName(); String testUser = getUserNameFreeDomain(testName + "1"); String siteName = getSiteName(testName); AdvanceSearchPage contentSearchPage; List<String> searchInfo = Arrays.asList(ADV_CONTENT_SEARCH); String searchTerm = siteName + "_test"; try { ShareUser.login(drone, testUser, testPassword); ShareUser.openSitesDocumentLibrary(drone, siteName); ShareUserSitePage.selectView(drone, ViewType.SIMPLE_VIEW); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + STR)); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + STR)); webDriverWait(drone,70000); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + STR)); ShareUserSitePage.editPropertiesFromDocLibPage(drone, siteName, (siteName + STR)); contentSearchPage = ShareUserSearchPage.navigateToAdvanceSearch(drone, searchInfo); contentSearchPage.inputKeyword(searchTerm); SearchResultsPage searchResultsPage = ShareUserSearchPage.clickSearchOnAdvanceSearch(drone); List<SearchResultItem> resultsList = ShareUserSearchPage.sortSearchResults(drone, SortType.MODIFIED); Assert.assertEquals(resultsList.get(0).getTitle(), searchTerm + "3"); Assert.assertEquals(resultsList.get(1).getTitle(), searchTerm + "1"); Assert.assertEquals(resultsList.get(2).getTitle(), searchTerm + "2"); searchInfo = Arrays.asList(ADV_FOLDER_SEARCH, STR); searchTerm = siteName + STR; contentSearchPage = ShareUserSearchPage.navigateToAdvanceSearch(drone, searchInfo); contentSearchPage.inputKeyword(searchTerm); searchResultsPage = ShareUserSearchPage.clickSearchOnAdvanceSearch(drone); resultsList = ShareUserSearchPage.sortSearchResults(drone, SortType.MODIFIED); Assert.assertEquals(resultsList.get(0).getTitle(), searchTerm + "3"); Assert.assertEquals(resultsList.get(1).getTitle(), searchTerm + "1"); Assert.assertEquals(resultsList.get(2).getTitle(), searchTerm + "2"); } catch (Throwable e) { reportError(drone, testName, e); } finally { testCleanup(drone, testName); } }
/** * Test - ALF-5026: :Sorting by Modified on Search page (Content/Folder type) * <ul> * <li>Login</li> * <li>From My Dashboard access the Advance Search form</li> * <li>Search with keyword</li> * <li>Select sort by Modified</li> * <li>Verify the search results are sorted by Modified Date</li> * </ul> */
Test - ALF-5026: :Sorting by Modified on Search page (Content/Folder type) Login From My Dashboard access the Advance Search form Search with keyword Select sort by Modified Verify the search results are sorted by Modified Date
ALF_5026
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/qa-share/src/test/java/org/alfresco/share/search/AdvanceSearchTest.java", "license": "lgpl-3.0", "size": 123894 }
[ "java.util.Arrays", "java.util.List", "org.alfresco.po.share.enums.ViewType", "org.alfresco.po.share.search.AdvanceSearchPage", "org.alfresco.po.share.search.SearchResultItem", "org.alfresco.po.share.search.SearchResultsPage", "org.alfresco.po.share.search.SortType", "org.alfresco.share.util.ShareUser", "org.alfresco.share.util.ShareUserSearchPage", "org.alfresco.share.util.ShareUserSitePage", "org.testng.Assert" ]
import java.util.Arrays; import java.util.List; import org.alfresco.po.share.enums.ViewType; import org.alfresco.po.share.search.AdvanceSearchPage; import org.alfresco.po.share.search.SearchResultItem; import org.alfresco.po.share.search.SearchResultsPage; import org.alfresco.po.share.search.SortType; import org.alfresco.share.util.ShareUser; import org.alfresco.share.util.ShareUserSearchPage; import org.alfresco.share.util.ShareUserSitePage; import org.testng.Assert;
import java.util.*; import org.alfresco.po.share.enums.*; import org.alfresco.po.share.search.*; import org.alfresco.share.util.*; import org.testng.*;
[ "java.util", "org.alfresco.po", "org.alfresco.share", "org.testng" ]
java.util; org.alfresco.po; org.alfresco.share; org.testng;
2,122,839
public static String createSelectorFromAddress(String address) { StringBuilder stringBuilder = new StringBuilder(); // Support standard address (not a list) case. if (!address.contains(",")) { if (address.startsWith("!")) { stringBuilder.append(ManagementHelper.HDR_ADDRESS + " NOT LIKE '" + address.substring(1, address.length()) + "%'"); } else { stringBuilder.append(ManagementHelper.HDR_ADDRESS + " LIKE '" + address + "%'"); } return stringBuilder.toString(); } // For comma separated lists build a JMS selector statement based on the list items return buildSelectorFromArray(address.split(",")); }
static String function(String address) { StringBuilder stringBuilder = new StringBuilder(); if (!address.contains(",")) { if (address.startsWith("!")) { stringBuilder.append(ManagementHelper.HDR_ADDRESS + STR + address.substring(1, address.length()) + "%'"); } else { stringBuilder.append(ManagementHelper.HDR_ADDRESS + STR + address + "%'"); } return stringBuilder.toString(); } return buildSelectorFromArray(address.split(",")); }
/** * Takes in a string of an address filter or comma separated list and generates an appropriate JMS selector for * filtering queues. * * @param address */
Takes in a string of an address filter or comma separated list and generates an appropriate JMS selector for filtering queues
createSelectorFromAddress
{ "repo_name": "thiagokronig/activemq-artemis", "path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java", "license": "apache-2.0", "size": 16309 }
[ "org.apache.activemq.artemis.api.core.management.ManagementHelper" ]
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.api.core.management.*;
[ "org.apache.activemq" ]
org.apache.activemq;
562,317
public static OtherRecipientInfo getInstance( Object obj) { if (obj == null || obj instanceof OtherRecipientInfo) { return (OtherRecipientInfo)obj; } if (obj instanceof ASN1Sequence) { return new OtherRecipientInfo((ASN1Sequence)obj); } throw new IllegalArgumentException("Invalid OtherRecipientInfo: " + obj.getClass().getName()); }
static OtherRecipientInfo function( Object obj) { if (obj == null obj instanceof OtherRecipientInfo) { return (OtherRecipientInfo)obj; } if (obj instanceof ASN1Sequence) { return new OtherRecipientInfo((ASN1Sequence)obj); } throw new IllegalArgumentException(STR + obj.getClass().getName()); }
/** * return a OtherRecipientInfo object from the given object. * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */
return a OtherRecipientInfo object from the given object
getInstance
{ "repo_name": "Z-Shang/onscripter-gbk", "path": "svn/onscripter-read-only/src/org/bouncycastle/asn1/cms/OtherRecipientInfo.java", "license": "gpl-2.0", "size": 2752 }
[ "org.bouncycastle.asn1.ASN1Sequence" ]
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.*;
[ "org.bouncycastle.asn1" ]
org.bouncycastle.asn1;
512,791
@Override public Long exec(Tuple input) throws IOException { Preconditions.checkArgument(input != null && input.size() >= 2, INVALID_TUPLE_MESSAGE); Long numToReserve = (Long)(input.get(0)); Preconditions.checkArgument(numToReserve > 0, INVALID_NUMBER_MESSAGE); String sequenceName = (String)input.get(1); Preconditions.checkNotNull(sequenceName, EMPTY_SEQUENCE_NAME_MESSAGE); // It will create a connection when called for the first Tuple per task. // The connection gets cleaned up in finish() method if (connection == null) { initConnection(); } ResultSet rs = null; try { String sql = getNextNSequenceSelectStatement(Long.valueOf(numToReserve), sequenceName); rs = connection.createStatement().executeQuery(sql); Preconditions.checkArgument(rs.next()); Long startIndex = rs.getLong(1); rs.close(); connection.commit(); return startIndex; } catch (SQLException e) { throw new IOException("Caught exception while processing row." + e.getMessage(), e); } }
Long function(Tuple input) throws IOException { Preconditions.checkArgument(input != null && input.size() >= 2, INVALID_TUPLE_MESSAGE); Long numToReserve = (Long)(input.get(0)); Preconditions.checkArgument(numToReserve > 0, INVALID_NUMBER_MESSAGE); String sequenceName = (String)input.get(1); Preconditions.checkNotNull(sequenceName, EMPTY_SEQUENCE_NAME_MESSAGE); if (connection == null) { initConnection(); } ResultSet rs = null; try { String sql = getNextNSequenceSelectStatement(Long.valueOf(numToReserve), sequenceName); rs = connection.createStatement().executeQuery(sql); Preconditions.checkArgument(rs.next()); Long startIndex = rs.getLong(1); rs.close(); connection.commit(); return startIndex; } catch (SQLException e) { throw new IOException(STR + e.getMessage(), e); } }
/** * Reserve N next sequences for a sequence name. N is the first field in the tuple. Sequence name is the second * field in the tuple zkquorum is the third field in the tuple */
Reserve N next sequences for a sequence name. N is the first field in the tuple. Sequence name is the second field in the tuple zkquorum is the third field in the tuple
exec
{ "repo_name": "shehzaadn/phoenix", "path": "phoenix-pig/src/main/java/org/apache/phoenix/pig/udf/ReserveNSequence.java", "license": "apache-2.0", "size": 5326 }
[ "com.google.common.base.Preconditions", "java.io.IOException", "java.sql.ResultSet", "java.sql.SQLException", "org.apache.pig.data.Tuple" ]
import com.google.common.base.Preconditions; import java.io.IOException; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.pig.data.Tuple;
import com.google.common.base.*; import java.io.*; import java.sql.*; import org.apache.pig.data.*;
[ "com.google.common", "java.io", "java.sql", "org.apache.pig" ]
com.google.common; java.io; java.sql; org.apache.pig;
142,716
private static boolean segsCross( float seg1pt1_x, float seg1pt1_y, float seg1pt2_x, float seg1pt2_y, float seg2pt1_x, float seg2pt1_y, float seg2pt2_x, float seg2pt2_y, Point crossPt ) { float vec1_x = seg1pt2_x - seg1pt1_x; float vec1_y = seg1pt2_y - seg1pt1_y; float vec2_x = seg2pt2_x - seg2pt1_x; float vec2_y = seg2pt2_y - seg2pt1_y; float div = ( -vec2_x * vec1_y + vec1_x * vec2_y ); // Segments don't cross if( div == 0 ) return false; float s = ( -vec1_y * ( seg1pt1_x - seg2pt1_x ) + vec1_x * ( seg1pt1_y - seg2pt1_y ) ) / div; float t = ( vec2_x * ( seg1pt1_y - seg2pt1_y ) - vec2_y * ( seg1pt1_x - seg2pt1_x ) ) / div; if( s >= 0 && s < 1 && t >= 0 && t <= 1 ) { // Segments cross, point of intersection stored in 'crossPt' crossPt.x = (int) ( seg1pt1_x + ( t * vec1_x ) ); crossPt.y = (int) ( seg1pt1_y + ( t * vec1_y ) ); return true; } // Segments don't cross return false; }
static boolean function( float seg1pt1_x, float seg1pt1_y, float seg1pt2_x, float seg1pt2_y, float seg2pt1_x, float seg2pt1_y, float seg2pt2_x, float seg2pt2_y, Point crossPt ) { float vec1_x = seg1pt2_x - seg1pt1_x; float vec1_y = seg1pt2_y - seg1pt1_y; float vec2_x = seg2pt2_x - seg2pt1_x; float vec2_y = seg2pt2_y - seg2pt1_y; float div = ( -vec2_x * vec1_y + vec1_x * vec2_y ); if( div == 0 ) return false; float s = ( -vec1_y * ( seg1pt1_x - seg2pt1_x ) + vec1_x * ( seg1pt1_y - seg2pt1_y ) ) / div; float t = ( vec2_x * ( seg1pt1_y - seg2pt1_y ) - vec2_y * ( seg1pt1_x - seg2pt1_x ) ) / div; if( s >= 0 && s < 1 && t >= 0 && t <= 1 ) { crossPt.x = (int) ( seg1pt1_x + ( t * vec1_x ) ); crossPt.y = (int) ( seg1pt1_y + ( t * vec1_y ) ); return true; } return false; }
/** * Determines if the two specified line segments intersect with each other, and calculates where * the intersection occurs if they do. * * @param seg1pt1_x X-coordinate for the first end of the first line segment. * @param seg1pt1_y Y-coordinate for the first end of the first line segment. * @param seg1pt2_x X-coordinate for the second end of the first line segment. * @param seg1pt2_y Y-coordinate for the second end of the first line segment. * @param seg2pt1_x X-coordinate for the first end of the second line segment. * @param seg2pt1_y Y-coordinate for the first end of the second line segment. * @param seg2pt2_x X-coordinate for the second end of the second line segment. * @param seg2pt2_y Y-coordinate for the second end of the second line segment. * @param crossPt Changed to the point of intersection if there is one, otherwise unchanged. * * @return True if the two line segments intersect. */
Determines if the two specified line segments intersect with each other, and calculates where the intersection occurs if they do
segsCross
{ "repo_name": "Frank-74/project64", "path": "Android/src/emu/project64/input/map/TouchMap.java", "license": "gpl-2.0", "size": 22194 }
[ "android.graphics.Point" ]
import android.graphics.Point;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,816,791
private void hideTabLayout() { tabLayout.setVisibility(View.GONE); }
void function() { tabLayout.setVisibility(View.GONE); }
/** * Hides the tab layout in the appbar. */
Hides the tab layout in the appbar
hideTabLayout
{ "repo_name": "alesar-code/whatwatch-android", "path": "app/presentation/src/main/java/com/alesarcode/whatwatch/presentation/view/activity/base/BaseSearchActivity.java", "license": "apache-2.0", "size": 7591 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,762,611
public Function removeFunction(Function desc) { // TODO: remove this from persistent store. synchronized (functions_) { Function fn = getFunction(desc, Function.CompareMode.IS_INDISTINGUISHABLE); if (fn == null) return null; List<Function> fns = functions_.get(desc.functionName()); Preconditions.checkNotNull(fns); fns.remove(fn); if (fns.isEmpty()) functions_.remove(desc.functionName()); return fn; } }
Function function(Function desc) { synchronized (functions_) { Function fn = getFunction(desc, Function.CompareMode.IS_INDISTINGUISHABLE); if (fn == null) return null; List<Function> fns = functions_.get(desc.functionName()); Preconditions.checkNotNull(fns); fns.remove(fn); if (fns.isEmpty()) functions_.remove(desc.functionName()); return fn; } }
/** * See comment in Catalog. */
See comment in Catalog
removeFunction
{ "repo_name": "theyaa/Impala", "path": "fe/src/main/java/com/cloudera/impala/catalog/Db.java", "license": "apache-2.0", "size": 9914 }
[ "com.cloudera.impala.catalog.Function", "com.google.common.base.Preconditions", "java.util.List" ]
import com.cloudera.impala.catalog.Function; import com.google.common.base.Preconditions; import java.util.List;
import com.cloudera.impala.catalog.*; import com.google.common.base.*; import java.util.*;
[ "com.cloudera.impala", "com.google.common", "java.util" ]
com.cloudera.impala; com.google.common; java.util;
2,782,425
public ResultSet retrieveResultSet(String sourceObjectName, String[] selectColumnName, QueryWhereClause queryWhereClause, boolean onlyDistinctRows) throws DAOException { try { StringBuffer queryStrBuff = generateSQL(sourceObjectName, selectColumnName, queryWhereClause, onlyDistinctRows); return getQueryResultSet(queryStrBuff.toString()); } catch (Exception exp) { ErrorKey errorKey = ErrorKey.getErrorKey("db.operation.error"); throw new DAOException(errorKey, exp,"AbstractJDBCDAOImpl.java :"+ DAOConstants.RETRIEVE_ERROR); } }
ResultSet function(String sourceObjectName, String[] selectColumnName, QueryWhereClause queryWhereClause, boolean onlyDistinctRows) throws DAOException { try { StringBuffer queryStrBuff = generateSQL(sourceObjectName, selectColumnName, queryWhereClause, onlyDistinctRows); return getQueryResultSet(queryStrBuff.toString()); } catch (Exception exp) { ErrorKey errorKey = ErrorKey.getErrorKey(STR); throw new DAOException(errorKey, exp,STR+ DAOConstants.RETRIEVE_ERROR); } }
/** * Retrieves the records for class name in sourceObjectName according to * field values passed in the passed session. * @param sourceObjectName This will holds the object name. * @param selectColumnName An array of field names in select clause. * @param queryWhereClause This will hold the where clause.It holds following: * 1.whereColumnName : An array of field names in where clause. * 2.whereColumnCondition : The comparison condition for the field values. * 3.whereColumnValue : An array of field values. * 4.joinCondition : The join condition. * @param onlyDistinctRows True if only distinct rows should be selected * @return The ResultSet containing all the rows from the table represented * in sourceObjectName which satisfies the where condition * @throws DAOException : DAOException */
Retrieves the records for class name in sourceObjectName according to field values passed in the passed session
retrieveResultSet
{ "repo_name": "NCIP/catissue-dao", "path": "src/edu/wustl/dao/AbstractJDBCDAOImpl.java", "license": "bsd-3-clause", "size": 26231 }
[ "edu.wustl.common.exception.ErrorKey", "edu.wustl.dao.exception.DAOException", "edu.wustl.dao.util.DAOConstants", "java.sql.ResultSet" ]
import edu.wustl.common.exception.ErrorKey; import edu.wustl.dao.exception.DAOException; import edu.wustl.dao.util.DAOConstants; import java.sql.ResultSet;
import edu.wustl.common.exception.*; import edu.wustl.dao.exception.*; import edu.wustl.dao.util.*; import java.sql.*;
[ "edu.wustl.common", "edu.wustl.dao", "java.sql" ]
edu.wustl.common; edu.wustl.dao; java.sql;
2,658,635
@Test @Feature({"Sync"}) public void testEnsureStartedAndUpdateRegisteredTypes() { InvalidationController controller = new InvalidationController(mContext, false, false); controller.ensureStartedAndUpdateRegisteredTypes(); Intent intent = getOnlyIntent(); // Ensure GCM is initialized. This is a regression test for http://crbug.com/475299. Assert.assertTrue(controller.isGcmInitialized()); // Validate destination. validateIntentComponent(intent); Assert.assertEquals(InvalidationIntentProtocol.ACTION_REGISTER, intent.getAction()); // Validate account. Account intentAccount = intent.getParcelableExtra(InvalidationIntentProtocol.EXTRA_ACCOUNT); Assert.assertEquals("[email protected]", intentAccount.name); // Validate registered types. Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(intent)); Assert.assertNull(InvalidationIntentProtocol.getRegisteredObjectIds(intent)); }
@Feature({"Sync"}) void function() { InvalidationController controller = new InvalidationController(mContext, false, false); controller.ensureStartedAndUpdateRegisteredTypes(); Intent intent = getOnlyIntent(); Assert.assertTrue(controller.isGcmInitialized()); validateIntentComponent(intent); Assert.assertEquals(InvalidationIntentProtocol.ACTION_REGISTER, intent.getAction()); Account intentAccount = intent.getParcelableExtra(InvalidationIntentProtocol.EXTRA_ACCOUNT); Assert.assertEquals(STR, intentAccount.name); Assert.assertEquals(mAllTypes, getRegisterIntentRegisterTypes(intent)); Assert.assertNull(InvalidationIntentProtocol.getRegisteredObjectIds(intent)); }
/** * Verify the intent sent by InvalidationController#ensureStartedAndUpdateRegisteredTypes(). */
Verify the intent sent by InvalidationController#ensureStartedAndUpdateRegisteredTypes()
testEnsureStartedAndUpdateRegisteredTypes
{ "repo_name": "Chilledheart/chromium", "path": "chrome/android/junit/src/org/chromium/chrome/browser/invalidations/InvalidationControllerTest.java", "license": "bsd-3-clause", "size": 19176 }
[ "android.accounts.Account", "android.content.Intent", "org.chromium.base.test.util.Feature", "org.chromium.sync.notifier.InvalidationIntentProtocol", "org.junit.Assert" ]
import android.accounts.Account; import android.content.Intent; import org.chromium.base.test.util.Feature; import org.chromium.sync.notifier.InvalidationIntentProtocol; import org.junit.Assert;
import android.accounts.*; import android.content.*; import org.chromium.base.test.util.*; import org.chromium.sync.notifier.*; import org.junit.*;
[ "android.accounts", "android.content", "org.chromium.base", "org.chromium.sync", "org.junit" ]
android.accounts; android.content; org.chromium.base; org.chromium.sync; org.junit;
934,718
public Set<Integer> getChosenDataTypes() { int[] modelTypeArray = ProfileSyncServiceJni.get().getChosenDataTypes( mNativeProfileSyncServiceAndroid, ProfileSyncService.this); return modelTypeArrayToSet(modelTypeArray); }
Set<Integer> function() { int[] modelTypeArray = ProfileSyncServiceJni.get().getChosenDataTypes( mNativeProfileSyncServiceAndroid, ProfileSyncService.this); return modelTypeArrayToSet(modelTypeArray); }
/** * Gets the set of data types that are enabled in sync. This will always * return a subset of syncer::UserSelectableTypes(). * * This is unaffected by whether sync is on. * * @return Set of chosen types. */
Gets the set of data types that are enabled in sync. This will always return a subset of syncer::UserSelectableTypes(). This is unaffected by whether sync is on
getChosenDataTypes
{ "repo_name": "endlessm/chromium-browser", "path": "chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java", "license": "bsd-3-clause", "size": 30031 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,443,763
public void setLensLocation(int x, int y) { lensController.setLensLocation(x, y); } public BufferedImage getZoomedImage() { return lensModel.getZoomedImage(); }
void function(int x, int y) { lensController.setLensLocation(x, y); } public BufferedImage getZoomedImage() { return lensModel.getZoomedImage(); }
/** * Sets the location of the lens on the canvas. * * @param x The x-coordinate. * @param y The y-coordinate. */
Sets the location of the lens on the canvas
setLensLocation
{ "repo_name": "lucalianas/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/lens/LensComponent.java", "license": "gpl-2.0", "size": 15423 }
[ "java.awt.image.BufferedImage" ]
import java.awt.image.BufferedImage;
import java.awt.image.*;
[ "java.awt" ]
java.awt;
17,763
public Application[] getApplicationsByOwner(String userId) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; ResultSet rs = null; Application[] applications = null; String sqlQuery = SQLConstants.GET_APPLICATIONS_BY_OWNER; try { connection = APIMgtDBUtil.getConnection(); prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, userId); rs = prepStmt.executeQuery(); ArrayList<Application> applicationsList = new ArrayList<Application>(); Application application; while (rs.next()) { application = new Application(rs.getString("UUID")); application.setName(rs.getString("NAME")); application.setOwner(rs.getString("CREATED_BY")); application.setStatus(rs.getString("APPLICATION_STATUS")); application.setGroupId(rs.getString("GROUP_ID")); if (multiGroupAppSharingEnabled) { application.setGroupId(getGroupId(rs.getInt("APPLICATION_ID"))); } applicationsList.add(application); } applications = applicationsList.toArray(new Application[applicationsList.size()]); } catch (SQLException e) { handleException("Error when getting the application name for id " + userId, e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, rs); } return applications; }
Application[] function(String userId) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; ResultSet rs = null; Application[] applications = null; String sqlQuery = SQLConstants.GET_APPLICATIONS_BY_OWNER; try { connection = APIMgtDBUtil.getConnection(); prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, userId); rs = prepStmt.executeQuery(); ArrayList<Application> applicationsList = new ArrayList<Application>(); Application application; while (rs.next()) { application = new Application(rs.getString("UUID")); application.setName(rs.getString("NAME")); application.setOwner(rs.getString(STR)); application.setStatus(rs.getString(STR)); application.setGroupId(rs.getString(STR)); if (multiGroupAppSharingEnabled) { application.setGroupId(getGroupId(rs.getInt(STR))); } applicationsList.add(application); } applications = applicationsList.toArray(new Application[applicationsList.size()]); } catch (SQLException e) { handleException(STR + userId, e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, rs); } return applications; }
/** * Returns all applications created by given user Id * * @param userId * @return * @throws APIManagementException */
Returns all applications created by given user Id
getApplicationsByOwner
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 811404 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.ArrayList", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.Application", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Application; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "java.util", "org.wso2.carbon" ]
java.sql; java.util; org.wso2.carbon;
1,772,941
public void changedUpdate(DocumentEvent e) { }
void function(DocumentEvent e) { }
/** * Called when the document is modified. * * @param e The document event. */
Called when the document is modified
changedUpdate
{ "repo_name": "curiosag/ftc", "path": "RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/ParserManager.java", "license": "gpl-3.0", "size": 22568 }
[ "javax.swing.event.DocumentEvent" ]
import javax.swing.event.DocumentEvent;
import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
1,451,625
public void initProviders(IMixinAnnotationProcessor ap) { if (this.providerInitDone) { return; } this.providerInitDone = true; boolean defaultIsPresent = false; Map<String, Set<String>> supportedTypes = new LinkedHashMap<String, Set<String>>(); try { for (IObfuscationService service : this.serviceLoader) { if (!this.services.contains(service)) { this.services.add(service); String serviceName = service.getClass().getSimpleName(); // ap.printMessage(Kind.NOTE, "Preparing service " + serviceName); Collection<ObfuscationTypeDescriptor> obfTypes = service.getObfuscationTypes(ap); if (obfTypes != null) { for (ObfuscationTypeDescriptor obfType : obfTypes) { try { ObfuscationType type = ObfuscationType.create(obfType, ap); Set<String> types = supportedTypes.get(serviceName); if (types == null) { supportedTypes.put(serviceName, types = new LinkedHashSet<String>()); } types.add(type.getKey()); defaultIsPresent |= type.isDefault(); } catch (Exception ex) { ex.printStackTrace(); } } } } } } catch (ServiceConfigurationError serviceError) { ap.printMessage(Kind.ERROR, serviceError.getClass().getSimpleName() + ": " + serviceError.getMessage()); serviceError.printStackTrace(); } if (supportedTypes.size() > 0) { StringBuilder sb = new StringBuilder("Supported obfuscation types:"); for (Entry<String, Set<String>> supportedType : supportedTypes.entrySet()) { sb.append(' ').append(supportedType.getKey()).append(" supports [").append(Joiner.on(',').join(supportedType.getValue())).append(']'); } ap.printMessage(MessageType.INFO, sb.toString()); } if (!defaultIsPresent) { String defaultEnv = ap.getOption(SupportedOptions.DEFAULT_OBFUSCATION_ENV); if (defaultEnv == null) { ap.printMessage(Kind.WARNING, "No default obfuscation environment was specified and \"" + ObfuscationType.DEFAULT_TYPE + "\" is not available. Please ensure defaultObfuscationEnv is specified in your build configuration"); } else { ap.printMessage(Kind.WARNING, "Specified default obfuscation environment \"" + defaultEnv.toLowerCase(Locale.ROOT) + "\" was not defined. This probably means your build configuration is out of date or a required service is missing"); } } }
void function(IMixinAnnotationProcessor ap) { if (this.providerInitDone) { return; } this.providerInitDone = true; boolean defaultIsPresent = false; Map<String, Set<String>> supportedTypes = new LinkedHashMap<String, Set<String>>(); try { for (IObfuscationService service : this.serviceLoader) { if (!this.services.contains(service)) { this.services.add(service); String serviceName = service.getClass().getSimpleName(); Collection<ObfuscationTypeDescriptor> obfTypes = service.getObfuscationTypes(ap); if (obfTypes != null) { for (ObfuscationTypeDescriptor obfType : obfTypes) { try { ObfuscationType type = ObfuscationType.create(obfType, ap); Set<String> types = supportedTypes.get(serviceName); if (types == null) { supportedTypes.put(serviceName, types = new LinkedHashSet<String>()); } types.add(type.getKey()); defaultIsPresent = type.isDefault(); } catch (Exception ex) { ex.printStackTrace(); } } } } } } catch (ServiceConfigurationError serviceError) { ap.printMessage(Kind.ERROR, serviceError.getClass().getSimpleName() + STR + serviceError.getMessage()); serviceError.printStackTrace(); } if (supportedTypes.size() > 0) { StringBuilder sb = new StringBuilder(STR); for (Entry<String, Set<String>> supportedType : supportedTypes.entrySet()) { sb.append(' ').append(supportedType.getKey()).append(STR).append(Joiner.on(',').join(supportedType.getValue())).append(']'); } ap.printMessage(MessageType.INFO, sb.toString()); } if (!defaultIsPresent) { String defaultEnv = ap.getOption(SupportedOptions.DEFAULT_OBFUSCATION_ENV); if (defaultEnv == null) { ap.printMessage(Kind.WARNING, STRSTR\STR); } else { ap.printMessage(Kind.WARNING, STRSTR\STR); } } }
/** * Initialise services * * @param ap annotation processor */
Initialise services
initProviders
{ "repo_name": "SpongePowered/Mixin", "path": "src/ap/java/org/spongepowered/tools/obfuscation/service/ObfuscationServices.java", "license": "mit", "size": 7227 }
[ "com.google.common.base.Joiner", "java.util.Collection", "java.util.LinkedHashMap", "java.util.LinkedHashSet", "java.util.Map", "java.util.ServiceConfigurationError", "java.util.Set", "javax.tools.Diagnostic", "org.spongepowered.tools.obfuscation.ObfuscationType", "org.spongepowered.tools.obfuscation.SupportedOptions", "org.spongepowered.tools.obfuscation.interfaces.IMessagerEx", "org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor" ]
import com.google.common.base.Joiner; import java.util.Collection; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.ServiceConfigurationError; import java.util.Set; import javax.tools.Diagnostic; import org.spongepowered.tools.obfuscation.ObfuscationType; import org.spongepowered.tools.obfuscation.SupportedOptions; import org.spongepowered.tools.obfuscation.interfaces.IMessagerEx; import org.spongepowered.tools.obfuscation.interfaces.IMixinAnnotationProcessor;
import com.google.common.base.*; import java.util.*; import javax.tools.*; import org.spongepowered.tools.obfuscation.*; import org.spongepowered.tools.obfuscation.interfaces.*;
[ "com.google.common", "java.util", "javax.tools", "org.spongepowered.tools" ]
com.google.common; java.util; javax.tools; org.spongepowered.tools;
259,076
public NoteItem getModifies() { return modifies; }
NoteItem function() { return modifies; }
/** * Gets modifies. * @return The note item. */
Gets modifies
getModifies
{ "repo_name": "Eisler/cosmo", "path": "cosmo-core/src/test/unit/java/org/unitedinternet/cosmo/model/mock/MockNoteItem.java", "license": "apache-2.0", "size": 7294 }
[ "org.unitedinternet.cosmo.model.NoteItem" ]
import org.unitedinternet.cosmo.model.NoteItem;
import org.unitedinternet.cosmo.model.*;
[ "org.unitedinternet.cosmo" ]
org.unitedinternet.cosmo;
237,705
@SuppressWarnings("unchecked") public static List<Character> getAt(char[] array, Collection indices) { return primitiveArrayGet(array, indices); }
@SuppressWarnings(STR) static List<Character> function(char[] array, Collection indices) { return primitiveArrayGet(array, indices); }
/** * Support the subscript operator with a collection for a char array * * @param array a char array * @param indices a collection of indices for the items to retrieve * @return list of the chars at the given indices * @since 1.0 */
Support the subscript operator with a collection for a char array
getAt
{ "repo_name": "armsargis/groovy", "path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 698233 }
[ "java.util.Collection", "java.util.List" ]
import java.util.Collection; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,497,244
@Override protected void onPreExecute() { // Before starting the actual import, we must make sure the sync // lock is not acquired, because we cannot perform an import if a // sync is in progress AppInitializer appInitializer = App.i().getAppInitializer(); SyncLock syncLock = appInitializer.getSyncLock(); syncLockId = syncLock.acquireLock(); if (syncLockId != SyncLock.FORBIDDEN) { String text = localization.getLanguage("dialog_importing_contacts"); dialogId = displayManager.showProgressDialog(getScreen(), text, false); } else { if (Log.isLoggable(Log.INFO)) { Log.info(TAG_LOG, "Cannot acquire sync lock, the import cannot be performed"); } // Show a timed alert and skip the import completely String text = localization.getLanguage("dialog_import_sync_in_progress"); displayManager.showMessage(getScreen(), text); } }
void function() { AppInitializer appInitializer = App.i().getAppInitializer(); SyncLock syncLock = appInitializer.getSyncLock(); syncLockId = syncLock.acquireLock(); if (syncLockId != SyncLock.FORBIDDEN) { String text = localization.getLanguage(STR); dialogId = displayManager.showProgressDialog(getScreen(), text, false); } else { if (Log.isLoggable(Log.INFO)) { Log.info(TAG_LOG, STR); } String text = localization.getLanguage(STR); displayManager.showMessage(getScreen(), text); } }
/** * Shows the progress dialog */
Shows the progress dialog
onPreExecute
{ "repo_name": "zhangdakun/funasyn", "path": "src/com/funambol/android/ContactsImporter.java", "license": "agpl-3.0", "size": 18483 }
[ "com.funambol.util.Log" ]
import com.funambol.util.Log;
import com.funambol.util.*;
[ "com.funambol.util" ]
com.funambol.util;
1,273,686
public static void populateClassesDir( Path outputJar, Path classesDir) { try { Preconditions.checkState(outputJar.toFile().exists()); Unzip.extractZipFile( outputJar, classesDir, Unzip.ExistingFileMode.OVERWRITE_AND_CLEAN_DIRECTORIES); } catch (IOException e) { throw new RuntimeException(e); } }
static void function( Path outputJar, Path classesDir) { try { Preconditions.checkState(outputJar.toFile().exists()); Unzip.extractZipFile( outputJar, classesDir, Unzip.ExistingFileMode.OVERWRITE_AND_CLEAN_DIRECTORIES); } catch (IOException e) { throw new RuntimeException(e); } }
/** * ReportGenerator.java needs a class-directory to work with, so if * we instead have a jar file we extract it first. */
ReportGenerator.java needs a class-directory to work with, so if we instead have a jar file we extract it first
populateClassesDir
{ "repo_name": "sdwilsh/buck", "path": "src/com/facebook/buck/jvm/java/GenerateCodeCoverageReportStep.java", "license": "apache-2.0", "size": 6500 }
[ "com.facebook.buck.zip.Unzip", "com.google.common.base.Preconditions", "java.io.IOException", "java.nio.file.Path" ]
import com.facebook.buck.zip.Unzip; import com.google.common.base.Preconditions; import java.io.IOException; import java.nio.file.Path;
import com.facebook.buck.zip.*; import com.google.common.base.*; import java.io.*; import java.nio.file.*;
[ "com.facebook.buck", "com.google.common", "java.io", "java.nio" ]
com.facebook.buck; com.google.common; java.io; java.nio;
1,406,616
public void exitGame(User user, IoSession session, SessionKey sessionKey) { BseExitGame.Builder builder = BseExitGame.newBuilder(); if ( user != null ) { long currentMillis = System.currentTimeMillis(); String exitMessage = null; String userRegDateStr = DateUtil.formatDate(user.getCdate()); String todayStr = DateUtil.getToday(currentMillis); if ( todayStr.equals(userRegDateStr) ) { //New user first access long userRegMillis = user.getCdate().getTime(); ExitPojo exitPojo = this.getExitPojoByDays(1); if ( exitPojo != null ) { String key = getExitgameRedisKey(user.getUsername()); Jedis jedis = JedisFactory.getJedisDB(); jedis.hset(key, DATE_FIELD, String.valueOf(userRegMillis+86400000*exitPojo.getDays())); jedis.hset(key, DAYS_FIELD, String.valueOf(exitPojo.getDays())); jedis.expire(key, 86400*(exitPojo.getDays()+1)); exitMessage = Text.text("exit.1"); } else { logger.warn("The ExitPojo day 1 is not configured."); } } int roleAction = user.getRoleTotalAction() - RoleActionManager.getInstance().getRoleActionPoint(user, currentMillis); String roleActionMessage = null; if ( roleAction > 0 ) { roleActionMessage = Text.text("active.roleaction", roleAction); } else { roleActionMessage = Text.text("active.roleaction.done"); } int treasureFreeCount = TreasureHuntManager.getInstance().getCurrentTreasureHuntFreeCount(user, currentMillis); String treasureMessage = null; if ( treasureFreeCount > 0 ) { treasureMessage = Text.text("active.treasure", treasureFreeCount); } else { treasureMessage = Text.text("active.treasure.done"); } int[] goldenPrayResult = CaishenManager.getInstance().queryCaishenPrayInfo(user, currentMillis, false); //当日可用的购买次数 int buyCount = goldenPrayResult[0]; String prayMessage = null; if ( buyCount > 0 ) { prayMessage = Text.text("active.pray", buyCount); } else { prayMessage = Text.text("active.pray.done"); } StringBuilder buf = new StringBuilder(); if ( exitMessage != null ) { buf.append(exitMessage); } buf.append(roleActionMessage); buf.append(treasureMessage); buf.append(prayMessage); builder.setInfo(buf.toString()); } else { builder.setInfo(Text.text("active.general")); } GameContext.getInstance().writeResponse(session, builder.build(), sessionKey); StatClient.getIntance().sendDataToStatServer(user, StatAction.ExitGame); }
void function(User user, IoSession session, SessionKey sessionKey) { BseExitGame.Builder builder = BseExitGame.newBuilder(); if ( user != null ) { long currentMillis = System.currentTimeMillis(); String exitMessage = null; String userRegDateStr = DateUtil.formatDate(user.getCdate()); String todayStr = DateUtil.getToday(currentMillis); if ( todayStr.equals(userRegDateStr) ) { long userRegMillis = user.getCdate().getTime(); ExitPojo exitPojo = this.getExitPojoByDays(1); if ( exitPojo != null ) { String key = getExitgameRedisKey(user.getUsername()); Jedis jedis = JedisFactory.getJedisDB(); jedis.hset(key, DATE_FIELD, String.valueOf(userRegMillis+86400000*exitPojo.getDays())); jedis.hset(key, DAYS_FIELD, String.valueOf(exitPojo.getDays())); jedis.expire(key, 86400*(exitPojo.getDays()+1)); exitMessage = Text.text(STR); } else { logger.warn(STR); } } int roleAction = user.getRoleTotalAction() - RoleActionManager.getInstance().getRoleActionPoint(user, currentMillis); String roleActionMessage = null; if ( roleAction > 0 ) { roleActionMessage = Text.text(STR, roleAction); } else { roleActionMessage = Text.text(STR); } int treasureFreeCount = TreasureHuntManager.getInstance().getCurrentTreasureHuntFreeCount(user, currentMillis); String treasureMessage = null; if ( treasureFreeCount > 0 ) { treasureMessage = Text.text(STR, treasureFreeCount); } else { treasureMessage = Text.text(STR); } int[] goldenPrayResult = CaishenManager.getInstance().queryCaishenPrayInfo(user, currentMillis, false); int buyCount = goldenPrayResult[0]; String prayMessage = null; if ( buyCount > 0 ) { prayMessage = Text.text(STR, buyCount); } else { prayMessage = Text.text(STR); } StringBuilder buf = new StringBuilder(); if ( exitMessage != null ) { buf.append(exitMessage); } buf.append(roleActionMessage); buf.append(treasureMessage); buf.append(prayMessage); builder.setInfo(buf.toString()); } else { builder.setInfo(Text.text(STR)); } GameContext.getInstance().writeResponse(session, builder.build(), sessionKey); StatClient.getIntance().sendDataToStatServer(user, StatAction.ExitGame); }
/** * Process the session key * @param user * @param session * @param sessionKey */
Process the session key
exitGame
{ "repo_name": "wangqi/gameserver", "path": "server/src/main/java/com/xinqihd/sns/gameserver/db/mongo/ExitGameManager.java", "license": "apache-2.0", "size": 8177 }
[ "com.xinqihd.sns.gameserver.GameContext", "com.xinqihd.sns.gameserver.config.ExitPojo", "com.xinqihd.sns.gameserver.entity.user.User", "com.xinqihd.sns.gameserver.jedis.Jedis", "com.xinqihd.sns.gameserver.jedis.JedisFactory", "com.xinqihd.sns.gameserver.proto.XinqiBseExitGame", "com.xinqihd.sns.gameserver.session.SessionKey", "com.xinqihd.sns.gameserver.transport.stat.StatAction", "com.xinqihd.sns.gameserver.transport.stat.StatClient", "com.xinqihd.sns.gameserver.treasure.TreasureHuntManager", "com.xinqihd.sns.gameserver.util.DateUtil", "com.xinqihd.sns.gameserver.util.Text", "org.apache.mina.core.session.IoSession" ]
import com.xinqihd.sns.gameserver.GameContext; import com.xinqihd.sns.gameserver.config.ExitPojo; import com.xinqihd.sns.gameserver.entity.user.User; import com.xinqihd.sns.gameserver.jedis.Jedis; import com.xinqihd.sns.gameserver.jedis.JedisFactory; import com.xinqihd.sns.gameserver.proto.XinqiBseExitGame; import com.xinqihd.sns.gameserver.session.SessionKey; import com.xinqihd.sns.gameserver.transport.stat.StatAction; import com.xinqihd.sns.gameserver.transport.stat.StatClient; import com.xinqihd.sns.gameserver.treasure.TreasureHuntManager; import com.xinqihd.sns.gameserver.util.DateUtil; import com.xinqihd.sns.gameserver.util.Text; import org.apache.mina.core.session.IoSession;
import com.xinqihd.sns.gameserver.*; import com.xinqihd.sns.gameserver.config.*; import com.xinqihd.sns.gameserver.entity.user.*; import com.xinqihd.sns.gameserver.jedis.*; import com.xinqihd.sns.gameserver.proto.*; import com.xinqihd.sns.gameserver.session.*; import com.xinqihd.sns.gameserver.transport.stat.*; import com.xinqihd.sns.gameserver.treasure.*; import com.xinqihd.sns.gameserver.util.*; import org.apache.mina.core.session.*;
[ "com.xinqihd.sns", "org.apache.mina" ]
com.xinqihd.sns; org.apache.mina;
79,719
public JRChart getChart() { return chart; }
JRChart function() { return chart; }
/** * Returns the definition of the multiple axis chart. This is separate * from and distinct that the definition of the nested charts. * * @return the chart object for this plot */
Returns the definition of the multiple axis chart. This is separate from and distinct that the definition of the nested charts
getChart
{ "repo_name": "delafer/j7project", "path": "jasper352/csb-jasperreport-dep/src/net/sf/jasperreports/charts/design/JRDesignMultiAxisPlot.java", "license": "gpl-2.0", "size": 3645 }
[ "net.sf.jasperreports.engine.JRChart" ]
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.*;
[ "net.sf.jasperreports" ]
net.sf.jasperreports;
1,280,067
@Override public Request<DescribeDhcpOptionsRequest> getDryRunRequest() { Request<DescribeDhcpOptionsRequest> request = new DescribeDhcpOptionsRequestMarshaller() .marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; }
Request<DescribeDhcpOptionsRequest> function() { Request<DescribeDhcpOptionsRequest> request = new DescribeDhcpOptionsRequestMarshaller() .marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; }
/** * This method is intended for internal use only. Returns the marshaled * request configured with additional parameters to enable operation * dry-run. */
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run
getDryRunRequest
{ "repo_name": "flofreud/aws-sdk-java", "path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeDhcpOptionsRequest.java", "license": "apache-2.0", "size": 22282 }
[ "com.amazonaws.Request", "com.amazonaws.services.ec2.model.transform.DescribeDhcpOptionsRequestMarshaller" ]
import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.DescribeDhcpOptionsRequestMarshaller;
import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*;
[ "com.amazonaws", "com.amazonaws.services" ]
com.amazonaws; com.amazonaws.services;
1,453,124
static Process runClient(List<String> command, Map<String, String> env) throws IOException { ProcessBuilder builder = new ProcessBuilder(command); if (env != null) { builder.environment().putAll(env); } Process result = builder.start(); return result; }
static Process runClient(List<String> command, Map<String, String> env) throws IOException { ProcessBuilder builder = new ProcessBuilder(command); if (env != null) { builder.environment().putAll(env); } Process result = builder.start(); return result; }
/** * Run a given command in a subprocess, including threads to copy its stdout * and stderr to our stdout and stderr. * @param command the command and its arguments * @param env the environment to run the process in * @return a handle on the process * @throws IOException */
Run a given command in a subprocess, including threads to copy its stdout and stderr to our stdout and stderr
runClient
{ "repo_name": "shakamunyi/hadoop-20", "path": "src/mapred/org/apache/hadoop/mapred/pipes/Application.java", "license": "apache-2.0", "size": 6735 }
[ "java.io.IOException", "java.util.List", "java.util.Map" ]
import java.io.IOException; import java.util.List; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,662,639
@Get("api/file/{id}") @NoCache public void readFile(@NotNull Long id) { Archive file =this.dbbackup.exists(id, Archive.class); if(file ==null){ this.fail("(No such file or directory)"); return; } LOGGER.error("arquivo: "+ this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator +file.getName()); try{ File initialFile = new File(this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName()); byte[] bytes = new byte[(int)initialFile.length()]; if(initialFile.exists()){ FileInputStream fis = new FileInputStream(initialFile); fis.read(bytes); fis.close(); response.getOutputStream().write(bytes); response.getOutputStream().close(); this.result.nothing(); }else { this.fail("(No such file or directory):"+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName() ); this.fail("arquivo: "+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName()); } } catch (Throwable ex) { LOGGER.error("Error while proxying the file upload.", ex); this.fail("(No such file or directory): "+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName() ); } }
@Get(STR) void function(@NotNull Long id) { Archive file =this.dbbackup.exists(id, Archive.class); if(file ==null){ this.fail(STR); return; } LOGGER.error(STR+ this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator +file.getName()); try{ File initialFile = new File(this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName()); byte[] bytes = new byte[(int)initialFile.length()]; if(initialFile.exists()){ FileInputStream fis = new FileInputStream(initialFile); fis.read(bytes); fis.close(); response.getOutputStream().write(bytes); response.getOutputStream().close(); this.result.nothing(); }else { this.fail(STR+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName() ); this.fail(STR+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName()); } } catch (Throwable ex) { LOGGER.error(STR, ex); this.fail(STR+this.request.getServletContext().getInitParameter(Controladora.URL_UPLOAD_FILE)+File.separator+file.getName() ); } }
/** * Leitura de arquivo local. * * @param Id do arquivo. * */
Leitura de arquivo local
readFile
{ "repo_name": "forpdi/forpdi", "path": "backend-java/src/main/java/org/forpdi/core/company/BackupAndRestoreController.java", "license": "apache-2.0", "size": 7505 }
[ "br.com.caelum.vraptor.Get", "com.controladora.base.Controladora", "java.io.File", "java.io.FileInputStream", "javax.validation.constraints.NotNull", "org.forpdi.system.Archive" ]
import br.com.caelum.vraptor.Get; import com.controladora.base.Controladora; import java.io.File; import java.io.FileInputStream; import javax.validation.constraints.NotNull; import org.forpdi.system.Archive;
import br.com.caelum.vraptor.*; import com.controladora.base.*; import java.io.*; import javax.validation.constraints.*; import org.forpdi.system.*;
[ "br.com.caelum", "com.controladora.base", "java.io", "javax.validation", "org.forpdi.system" ]
br.com.caelum; com.controladora.base; java.io; javax.validation; org.forpdi.system;
1,803,868
public void onUpdate() { if (this.worldObj.isRemote || (this.shootingEntity == null || !this.shootingEntity.isDead) && this.worldObj.isBlockLoaded(new BlockPos(this))) { super.onUpdate(); if (this.func_184564_k()) { this.setFire(1); } if (this.inGround) { if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksAlive; if (this.ticksAlive == 600) { this.setDead(); } return; } this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksAlive = 0; this.ticksInAir = 0; } else { ++this.ticksInAir; } RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, this.ticksInAir >= 25, this.shootingEntity); if (raytraceresult != null) { this.onImpact(raytraceresult); } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; ProjectileHelper.func_188803_a(this, 0.2F); float f = this.getMotionFactor(); if (this.isInWater()) { for (int i = 0; i < 4; ++i) { float f1 = 0.25F; this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f1, this.posY - this.motionY * (double)f1, this.posZ - this.motionZ * (double)f1, this.motionX, this.motionY, this.motionZ, new int[0]); } f = 0.8F; } this.motionX += this.accelerationX; this.motionY += this.accelerationY; this.motionZ += this.accelerationZ; this.motionX *= (double)f; this.motionY *= (double)f; this.motionZ *= (double)f; this.worldObj.spawnParticle(this.getParticleType(), this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.setPosition(this.posX, this.posY, this.posZ); } else { this.setDead(); } }
void function() { if (this.worldObj.isRemote (this.shootingEntity == null !this.shootingEntity.isDead) && this.worldObj.isBlockLoaded(new BlockPos(this))) { super.onUpdate(); if (this.func_184564_k()) { this.setFire(1); } if (this.inGround) { if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksAlive; if (this.ticksAlive == 600) { this.setDead(); } return; } this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksAlive = 0; this.ticksInAir = 0; } else { ++this.ticksInAir; } RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, this.ticksInAir >= 25, this.shootingEntity); if (raytraceresult != null) { this.onImpact(raytraceresult); } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; ProjectileHelper.func_188803_a(this, 0.2F); float f = this.getMotionFactor(); if (this.isInWater()) { for (int i = 0; i < 4; ++i) { float f1 = 0.25F; this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f1, this.posY - this.motionY * (double)f1, this.posZ - this.motionZ * (double)f1, this.motionX, this.motionY, this.motionZ, new int[0]); } f = 0.8F; } this.motionX += this.accelerationX; this.motionY += this.accelerationY; this.motionZ += this.accelerationZ; this.motionX *= (double)f; this.motionY *= (double)f; this.motionZ *= (double)f; this.worldObj.spawnParticle(this.getParticleType(), this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); this.setPosition(this.posX, this.posY, this.posZ); } else { this.setDead(); } }
/** * Called to update the entity's position/logic. */
Called to update the entity's position/logic
onUpdate
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/projectile/EntityFireball.java", "license": "gpl-3.0", "size": 10501 }
[ "net.minecraft.util.EnumParticleTypes", "net.minecraft.util.math.BlockPos", "net.minecraft.util.math.RayTraceResult" ]
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.*; import net.minecraft.util.math.*;
[ "net.minecraft.util" ]
net.minecraft.util;
1,612,710
public boolean login(String hostname) throws IOException { return SMTPReply.isPositiveCompletion(helo(hostname)); }
boolean function(String hostname) throws IOException { return SMTPReply.isPositiveCompletion(helo(hostname)); }
/*** * Login to the SMTP server by sending the HELO command with the * given hostname as an argument. Before performing any mail commands, * you must first login. * <p> * @param hostname The hostname with which to greet the SMTP server. * @return True if successfully completed, false if not. * @exception SMTPConnectionClosedException * If the SMTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send SMTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/
Login to the SMTP server by sending the HELO command with the given hostname as an argument. Before performing any mail commands, you must first login.
login
{ "repo_name": "codolutions/commons-net", "path": "src/main/java/org/apache/commons/net/smtp/SMTPClient.java", "license": "apache-2.0", "size": 25854 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,228,885
protected void buildDocument() throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); dbfactory.setNamespaceAware(true); DocumentBuilder docbuild = dbfactory.newDocumentBuilder(); WSDLDOC = docbuild.parse(CONN.getInputStream()); }
void function() throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); dbfactory.setNamespaceAware(true); DocumentBuilder docbuild = dbfactory.newDocumentBuilder(); WSDLDOC = docbuild.parse(CONN.getInputStream()); }
/** * Method is used internally to parse the InputStream and build the document * using javax.xml.parser API. * * @throws ParserConfigurationException When building {@link DocumentBuilder} fails * @throws IOException when reading the document fails * @throws SAXException when parsing the document fails */
Method is used internally to parse the InputStream and build the document using javax.xml.parser API
buildDocument
{ "repo_name": "hizhangqi/jmeter-1", "path": "src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java", "license": "apache-2.0", "size": 15395 }
[ "java.io.IOException", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "org.xml.sax.SAXException" ]
import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException;
import java.io.*; import javax.xml.parsers.*; import org.xml.sax.*;
[ "java.io", "javax.xml", "org.xml.sax" ]
java.io; javax.xml; org.xml.sax;
2,155,974
// On créé le spawn for (int i = 0; i < LGR_SPAWN; i++) { for (int j = 0; j < LGR_SPAWN; j++) { this.addBlock(sender, i, 195, j, Material.WOOL); this.addBlock(sender, i, 205, j, Material.GLASS); if (j == 0 || j == (LGR_SPAWN - 1)) { this.addBlock(sender, i, 196, j, Material.BRICK); this.addBlock(sender, i, 197, j, Material.BRICK); this.addBlock(sender, i, 198, j, Material.BRICK); this.addBlock(sender, i, 199, j, Material.BRICK); this.addBlock(sender, i, 200, j, Material.BRICK); this.addBlock(sender, i, 201, j, Material.BRICK); this.addBlock(sender, i, 202, j, Material.BRICK); this.addBlock(sender, i, 203, j, Material.BRICK); this.addBlock(sender, i, 204, j, Material.BRICK); } if (i == 0 || i == (LGR_SPAWN - 1)) { this.addBlock(sender, i, 196, j, Material.BRICK); this.addBlock(sender, i, 197, j, Material.BRICK); this.addBlock(sender, i, 198, j, Material.BRICK); this.addBlock(sender, i, 199, j, Material.BRICK); this.addBlock(sender, i, 200, j, Material.BRICK); this.addBlock(sender, i, 201, j, Material.BRICK); this.addBlock(sender, i, 202, j, Material.BRICK); this.addBlock(sender, i, 203, j, Material.BRICK); this.addBlock(sender, i, 204, j, Material.BRICK); } } } }
for (int i = 0; i < LGR_SPAWN; i++) { for (int j = 0; j < LGR_SPAWN; j++) { this.addBlock(sender, i, 195, j, Material.WOOL); this.addBlock(sender, i, 205, j, Material.GLASS); if (j == 0 j == (LGR_SPAWN - 1)) { this.addBlock(sender, i, 196, j, Material.BRICK); this.addBlock(sender, i, 197, j, Material.BRICK); this.addBlock(sender, i, 198, j, Material.BRICK); this.addBlock(sender, i, 199, j, Material.BRICK); this.addBlock(sender, i, 200, j, Material.BRICK); this.addBlock(sender, i, 201, j, Material.BRICK); this.addBlock(sender, i, 202, j, Material.BRICK); this.addBlock(sender, i, 203, j, Material.BRICK); this.addBlock(sender, i, 204, j, Material.BRICK); } if (i == 0 i == (LGR_SPAWN - 1)) { this.addBlock(sender, i, 196, j, Material.BRICK); this.addBlock(sender, i, 197, j, Material.BRICK); this.addBlock(sender, i, 198, j, Material.BRICK); this.addBlock(sender, i, 199, j, Material.BRICK); this.addBlock(sender, i, 200, j, Material.BRICK); this.addBlock(sender, i, 201, j, Material.BRICK); this.addBlock(sender, i, 202, j, Material.BRICK); this.addBlock(sender, i, 203, j, Material.BRICK); this.addBlock(sender, i, 204, j, Material.BRICK); } } } }
/** * Ajoute le spawn * * @param sender */
Ajoute le spawn
addSpawn
{ "repo_name": "haxakl/pluginMinecaft", "path": "src/game/Spawn.java", "license": "gpl-2.0", "size": 3404 }
[ "org.bukkit.Material" ]
import org.bukkit.Material;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
381,545
public final Response head(Reference resourceRef) { return handle(new Request(Method.HEAD, resourceRef)); }
final Response function(Reference resourceRef) { return handle(new Request(Method.HEAD, resourceRef)); }
/** * Gets the identified resource without its representation's content. * * @param resourceRef * The reference of the resource to get. * @return The response. */
Gets the identified resource without its representation's content
head
{ "repo_name": "atealxt/work-workspaces", "path": "HttpForwardDemo/src_restlet/org/restlet/Uniform.java", "license": "mit", "size": 6834 }
[ "org.restlet.data.Method", "org.restlet.data.Reference", "org.restlet.data.Request", "org.restlet.data.Response" ]
import org.restlet.data.Method; import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.data.Response;
import org.restlet.data.*;
[ "org.restlet.data" ]
org.restlet.data;
1,850,819
public static SignatureValidationFilter buildSignatureValidationFilter(final Resource signatureResourceLocation) throws Exception { if (!ResourceUtils.doesResourceExist(signatureResourceLocation)) { LOGGER.warn("Resource [{}] cannot be located", signatureResourceLocation); return null; } final List<KeyInfoProvider> keyInfoProviderList = new ArrayList<>(); keyInfoProviderList.add(new RSAKeyValueProvider()); keyInfoProviderList.add(new DSAKeyValueProvider()); keyInfoProviderList.add(new DEREncodedKeyValueProvider()); keyInfoProviderList.add(new InlineX509DataProvider()); LOGGER.debug("Attempting to resolve credentials from [{}]", signatureResourceLocation); final BasicCredential credential = buildCredentialForMetadataSignatureValidation(signatureResourceLocation); LOGGER.info("Successfully resolved credentials from [{}]", signatureResourceLocation); LOGGER.debug("Configuring credential resolver for key signature trust engine @ [{}]", credential.getCredentialType().getSimpleName()); final StaticCredentialResolver resolver = new StaticCredentialResolver(credential); final BasicProviderKeyInfoCredentialResolver keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(keyInfoProviderList); final ExplicitKeySignatureTrustEngine trustEngine = new ExplicitKeySignatureTrustEngine(resolver, keyInfoResolver); LOGGER.debug("Adding signature validation filter based on the configured trust engine"); final SignatureValidationFilter signatureValidationFilter = new SignatureValidationFilter(trustEngine); signatureValidationFilter.setRequireSignedRoot(false); LOGGER.debug("Added metadata SignatureValidationFilter with signature from [{}]", signatureResourceLocation); return signatureValidationFilter; }
static SignatureValidationFilter function(final Resource signatureResourceLocation) throws Exception { if (!ResourceUtils.doesResourceExist(signatureResourceLocation)) { LOGGER.warn(STR, signatureResourceLocation); return null; } final List<KeyInfoProvider> keyInfoProviderList = new ArrayList<>(); keyInfoProviderList.add(new RSAKeyValueProvider()); keyInfoProviderList.add(new DSAKeyValueProvider()); keyInfoProviderList.add(new DEREncodedKeyValueProvider()); keyInfoProviderList.add(new InlineX509DataProvider()); LOGGER.debug(STR, signatureResourceLocation); final BasicCredential credential = buildCredentialForMetadataSignatureValidation(signatureResourceLocation); LOGGER.info(STR, signatureResourceLocation); LOGGER.debug(STR, credential.getCredentialType().getSimpleName()); final StaticCredentialResolver resolver = new StaticCredentialResolver(credential); final BasicProviderKeyInfoCredentialResolver keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(keyInfoProviderList); final ExplicitKeySignatureTrustEngine trustEngine = new ExplicitKeySignatureTrustEngine(resolver, keyInfoResolver); LOGGER.debug(STR); final SignatureValidationFilter signatureValidationFilter = new SignatureValidationFilter(trustEngine); signatureValidationFilter.setRequireSignedRoot(false); LOGGER.debug(STR, signatureResourceLocation); return signatureValidationFilter; }
/** * Build signature validation filter if needed. * * @param signatureResourceLocation the signature resource location * @return the metadata filter * @throws Exception the exception */
Build signature validation filter if needed
buildSignatureValidationFilter
{ "repo_name": "prigaux/cas", "path": "support/cas-server-support-saml-core/src/main/java/org/apereo/cas/support/saml/SamlUtils.java", "license": "apache-2.0", "size": 11144 }
[ "java.util.ArrayList", "java.util.List", "org.apereo.cas.util.ResourceUtils", "org.opensaml.saml.metadata.resolver.filter.impl.SignatureValidationFilter", "org.opensaml.security.credential.BasicCredential", "org.opensaml.security.credential.impl.StaticCredentialResolver", "org.opensaml.xmlsec.keyinfo.impl.BasicProviderKeyInfoCredentialResolver", "org.opensaml.xmlsec.keyinfo.impl.KeyInfoProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.DEREncodedKeyValueProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.DSAKeyValueProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.InlineX509DataProvider", "org.opensaml.xmlsec.keyinfo.impl.provider.RSAKeyValueProvider", "org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngine", "org.springframework.core.io.Resource" ]
import java.util.ArrayList; import java.util.List; import org.apereo.cas.util.ResourceUtils; import org.opensaml.saml.metadata.resolver.filter.impl.SignatureValidationFilter; import org.opensaml.security.credential.BasicCredential; import org.opensaml.security.credential.impl.StaticCredentialResolver; import org.opensaml.xmlsec.keyinfo.impl.BasicProviderKeyInfoCredentialResolver; import org.opensaml.xmlsec.keyinfo.impl.KeyInfoProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.DEREncodedKeyValueProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.DSAKeyValueProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.InlineX509DataProvider; import org.opensaml.xmlsec.keyinfo.impl.provider.RSAKeyValueProvider; import org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngine; import org.springframework.core.io.Resource;
import java.util.*; import org.apereo.cas.util.*; import org.opensaml.saml.metadata.resolver.filter.impl.*; import org.opensaml.security.credential.*; import org.opensaml.security.credential.impl.*; import org.opensaml.xmlsec.keyinfo.impl.*; import org.opensaml.xmlsec.keyinfo.impl.provider.*; import org.opensaml.xmlsec.signature.support.impl.*; import org.springframework.core.io.*;
[ "java.util", "org.apereo.cas", "org.opensaml.saml", "org.opensaml.security", "org.opensaml.xmlsec", "org.springframework.core" ]
java.util; org.apereo.cas; org.opensaml.saml; org.opensaml.security; org.opensaml.xmlsec; org.springframework.core;
2,903,982
@Deprecated void setOwners(PerunSession perunSession, Facility facility, List<Owner> owners) throws InternalErrorException, OwnerNotExistsException;
void setOwners(PerunSession perunSession, Facility facility, List<Owner> owners) throws InternalErrorException, OwnerNotExistsException;
/** * Updates owners of facility * * @param perunSession * @param facility * @param owners * * @throws InternalErrorException * * @deprecated Use addOwner and removeOwner instead */
Updates owners of facility
setOwners
{ "repo_name": "Holdo/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/FacilitiesManagerBl.java", "license": "bsd-2-clause", "size": 34151 }
[ "cz.metacentrum.perun.core.api.Facility", "cz.metacentrum.perun.core.api.Owner", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.OwnerNotExistsException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.Owner; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.OwnerNotExistsException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,452,971
public void setScrubberColor(int color) { mScrubber.setColorStateList(ColorStateList.valueOf(color)); }
void function(int color) { mScrubber.setColorStateList(ColorStateList.valueOf(color)); }
/** * Sets the color of the seekbar scrubber * * @param color The color the track scrubber will be changed to */
Sets the color of the seekbar scrubber
setScrubberColor
{ "repo_name": "AOrobator/discreteSeekBar", "path": "library/src/main/java/org/adw/library/widgets/discreteseekbar/DiscreteSeekBar.java", "license": "apache-2.0", "size": 41578 }
[ "android.content.res.ColorStateList" ]
import android.content.res.ColorStateList;
import android.content.res.*;
[ "android.content" ]
android.content;
964,925
@Column(length = 255) @Field public void setEnName(String enName) { this.enName = enName; }
@Column(length = 255) void function(String enName) { this.enName = enName; }
/** * Sets the en name. * * @param enName the new en name */
Sets the en name
setEnName
{ "repo_name": "AAFC-MBB/hpdb", "path": "src/main/java/ca/gc/agr/mbb/hostpathogen/web/model/Host.java", "license": "mit", "size": 6051 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,313,201
Annotation createWarningAnnotation(@NotNull ASTNode node, @Nullable String message);
Annotation createWarningAnnotation(@NotNull ASTNode node, @Nullable String message);
/** * Creates a warning annotation with the specified message over the specified AST node. * * @param node the node over which the annotation is created. * @param message the warning message. * @return the annotation (which can be modified to set additional annotation parameters) */
Creates a warning annotation with the specified message over the specified AST node
createWarningAnnotation
{ "repo_name": "ernestp/consulo", "path": "platform/lang-api/src/com/intellij/lang/annotation/AnnotationHolder.java", "license": "apache-2.0", "size": 7114 }
[ "com.intellij.lang.ASTNode", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import com.intellij.lang.*; import org.jetbrains.annotations.*;
[ "com.intellij.lang", "org.jetbrains.annotations" ]
com.intellij.lang; org.jetbrains.annotations;
1,867,344
public void bind(String name, Object obj) throws NamingException { bind(name, obj, null); }
void function(String name, Object obj) throws NamingException { bind(name, obj, null); }
/** * Binds a name to an object. * * @param name the name to bind; may not be empty * @param obj the object to bind; possibly null * @exception NameAlreadyBoundException if name is already bound * @exception InvalidAttributesException if object did not supply all * mandatory attributes * @exception NamingException if a naming exception is encountered */
Binds a name to an object
bind
{ "repo_name": "plumer/codana", "path": "tomcat_files/7.0.0/BaseDirContext.java", "license": "mit", "size": 57376 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
2,558,156
protected void addSearchFilterCondition( CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) { String searchFilter = searchParams.getSearchFilter(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchFilter)) { boolean caseInsensitive = !searchParams.isCaseSensitive(); if (caseInsensitive) { searchFilter = searchFilter.toLowerCase(); } CmsCompositeQueryFragment searchCondition = new CmsCompositeQueryFragment(); searchCondition.setSeparator(" OR "); searchCondition.setPrefix("("); searchCondition.setSuffix(")"); //use coalesce in case any of the name columns are null String patternExprTemplate = generateConcat( "COALESCE(%1$s, '')", "' '", "COALESCE(%2$s, '')", "' '", "COALESCE(%3$s, '')"); patternExprTemplate = wrapLower(patternExprTemplate, caseInsensitive); String patternExpr = String.format( patternExprTemplate, users.column(colName()), users.column(colFirstName()), users.column(colLastName())); String like = " LIKE ? ESCAPE '!' "; String matchExpr = patternExpr + like; searchFilter = "%" + CmsEncoder.escapeSqlLikePattern(searchFilter, '!') + '%'; searchCondition.add(new CmsSimpleQueryFragment(matchExpr, searchFilter)); for (SearchKey key : searchParams.getSearchKeys()) { switch (key) { case email: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colEmail()), caseInsensitive) + like, searchFilter)); break; case orgUnit: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colOu()), caseInsensitive) + like, searchFilter)); break; default: break; } } select.addCondition(searchCondition); } }
void function( CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) { String searchFilter = searchParams.getSearchFilter(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchFilter)) { boolean caseInsensitive = !searchParams.isCaseSensitive(); if (caseInsensitive) { searchFilter = searchFilter.toLowerCase(); } CmsCompositeQueryFragment searchCondition = new CmsCompositeQueryFragment(); searchCondition.setSeparator(STR); searchCondition.setPrefix("("); searchCondition.setSuffix(")"); String patternExprTemplate = generateConcat( STR, STR, STR, STR, STR); patternExprTemplate = wrapLower(patternExprTemplate, caseInsensitive); String patternExpr = String.format( patternExprTemplate, users.column(colName()), users.column(colFirstName()), users.column(colLastName())); String like = STR; String matchExpr = patternExpr + like; searchFilter = "%" + CmsEncoder.escapeSqlLikePattern(searchFilter, '!') + '%'; searchCondition.add(new CmsSimpleQueryFragment(matchExpr, searchFilter)); for (SearchKey key : searchParams.getSearchKeys()) { switch (key) { case email: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colEmail()), caseInsensitive) + like, searchFilter)); break; case orgUnit: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colOu()), caseInsensitive) + like, searchFilter)); break; default: break; } } select.addCondition(searchCondition); } }
/** * Adds a search condition to a query.<p> * * @param select the query * @param users the user table alias * @param searchParams the search criteria */
Adds a search condition to a query
addSearchFilterCondition
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/db/generic/CmsUserQueryBuilder.java", "license": "lgpl-2.1", "size": 24453 }
[ "org.opencms.db.CmsCompositeQueryFragment", "org.opencms.db.CmsSelectQuery", "org.opencms.db.CmsSimpleQueryFragment", "org.opencms.file.CmsUserSearchParameters", "org.opencms.i18n.CmsEncoder", "org.opencms.util.CmsStringUtil" ]
import org.opencms.db.CmsCompositeQueryFragment; import org.opencms.db.CmsSelectQuery; import org.opencms.db.CmsSimpleQueryFragment; import org.opencms.file.CmsUserSearchParameters; import org.opencms.i18n.CmsEncoder; import org.opencms.util.CmsStringUtil;
import org.opencms.db.*; import org.opencms.file.*; import org.opencms.i18n.*; import org.opencms.util.*;
[ "org.opencms.db", "org.opencms.file", "org.opencms.i18n", "org.opencms.util" ]
org.opencms.db; org.opencms.file; org.opencms.i18n; org.opencms.util;
170,390
public void testModifyBannerWithoutSomeRequiredFields() throws MalformedURLException { Map<String, Object> struct = new HashMap<String, Object>(); struct.put(CAMPAIGN_ID, campaignId); struct.put(BANNER_NAME, "test Banner Modified"); Object[] params = new Object[] { sessionId, struct }; executeModifyBannerWithError(params, ErrorMessage.getMessage( ErrorMessage.FIELD_IN_STRUCTURE_DOES_NOT_EXISTS, BANNER_ID)); }
void function() throws MalformedURLException { Map<String, Object> struct = new HashMap<String, Object>(); struct.put(CAMPAIGN_ID, campaignId); struct.put(BANNER_NAME, STR); Object[] params = new Object[] { sessionId, struct }; executeModifyBannerWithError(params, ErrorMessage.getMessage( ErrorMessage.FIELD_IN_STRUCTURE_DOES_NOT_EXISTS, BANNER_ID)); }
/** * Test method without some required fields. * * @throws MalformedURLException */
Test method without some required fields
testModifyBannerWithoutSomeRequiredFields
{ "repo_name": "adqio/revive-adserver", "path": "www/api/v2/xmlrpc/tests/unit/src/test/java/org/openx/banner/TestModifyBanner.java", "license": "gpl-2.0", "size": 8272 }
[ "java.net.MalformedURLException", "java.util.HashMap", "java.util.Map", "org.openx.utils.ErrorMessage" ]
import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; import org.openx.utils.ErrorMessage;
import java.net.*; import java.util.*; import org.openx.utils.*;
[ "java.net", "java.util", "org.openx.utils" ]
java.net; java.util; org.openx.utils;
1,811,113
public DcmElement putDT(int tag) { return put(StringElement.createDT(tag)); }
DcmElement function(int tag) { return put(StringElement.createDT(tag)); }
/** * Description of the Method * * @param tag Description of the Parameter * @return Description of the Return Value */
Description of the Method
putDT
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/tags/DCM4CHE_1_4_2/src/java/org/dcm4cheri/data/DcmObjectImpl.java", "license": "apache-2.0", "size": 83021 }
[ "org.dcm4che.data.DcmElement" ]
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.*;
[ "org.dcm4che.data" ]
org.dcm4che.data;
1,519,899
public static String md5(String input) { String md5 = null; if(null == input) return null; try { //Create MessageDigest object for MD5 MessageDigest digest = MessageDigest.getInstance("MD5"); //Update input string in message digest digest.update(input.getBytes(), 0, input.length()); //Converts message digest value in base 16 (hex) md5 = new BigInteger(1, digest.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; }
static String function(String input) { String md5 = null; if(null == input) return null; try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(input.getBytes(), 0, input.length()); md5 = new BigInteger(1, digest.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; }
/** * Generates an md5 hash of a String. * @param input String value * @return Hashvalue of the String. */
Generates an md5 hash of a String
md5
{ "repo_name": "socia-platform/socia", "path": "app/controllers/Component.java", "license": "mit", "size": 2742 }
[ "java.math.BigInteger", "java.security.MessageDigest", "java.security.NoSuchAlgorithmException" ]
import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException;
import java.math.*; import java.security.*;
[ "java.math", "java.security" ]
java.math; java.security;
2,080,400
public void setInventorySlotContents(int index, ItemStack stack) { this.stackList[index] = stack; this.eventHandler.onCraftMatrixChanged(this); }
void function(int index, ItemStack stack) { this.stackList[index] = stack; this.eventHandler.onCraftMatrixChanged(this); }
/** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections)
setInventorySlotContents
{ "repo_name": "TorchPowered/CraftBloom", "path": "src/net/minecraft/inventory/InventoryCrafting.java", "license": "mit", "size": 5424 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
548,401
public void testStackTrace() { String version = System.getProperty("java.version"); if (version.startsWith("1.3.")) { return; } Exception ex = new Exception("some exception"); String causedBy = "Caused by: java.lang.Exception: some exception"; try { throw new RuntimeExceptionWrapper(ex); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String s = sw.toString(); assertTrue(s.indexOf(causedBy) != -1); } try { throw new IOExceptionWrapper(ex); } catch (IOException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String s = sw.toString(); assertTrue(s.indexOf(causedBy) != -1); } }
void function() { String version = System.getProperty(STR); if (version.startsWith("1.3.")) { return; } Exception ex = new Exception(STR); String causedBy = STR; try { throw new RuntimeExceptionWrapper(ex); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String s = sw.toString(); assertTrue(s.indexOf(causedBy) != -1); } try { throw new IOExceptionWrapper(ex); } catch (IOException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String s = sw.toString(); assertTrue(s.indexOf(causedBy) != -1); } }
/** * Generates a stack trace for a nested exception and checks the output * for the nested exception. */
Generates a stack trace for a nested exception and checks the output for the nested exception
testStackTrace
{ "repo_name": "mxrrow/zaicoin", "path": "src/deps/db/test/scr024/src/com/sleepycat/util/test/ExceptionWrapperTest.java", "license": "mit", "size": 3867 }
[ "com.sleepycat.util.IOExceptionWrapper", "com.sleepycat.util.RuntimeExceptionWrapper", "java.io.IOException", "java.io.PrintWriter", "java.io.StringWriter" ]
import com.sleepycat.util.IOExceptionWrapper; import com.sleepycat.util.RuntimeExceptionWrapper; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter;
import com.sleepycat.util.*; import java.io.*;
[ "com.sleepycat.util", "java.io" ]
com.sleepycat.util; java.io;
1,290,041
WebMessageServer addHandler(String path,WebSocketHandler handler);
WebMessageServer addHandler(String path,WebSocketHandler handler);
/** * Add a WebSocketHandler which handles certain path websocket path. * @param path * @param handler WebSocketHandler * @return current WebMessageServer * @see WebSocketHandler */
Add a WebSocketHandler which handles certain path websocket path
addHandler
{ "repo_name": "brucefengnju/webmessage", "path": "src/main/java/org/webmessage/WebMessageServer.java", "license": "bsd-3-clause", "size": 1696 }
[ "org.webmessage.handler.websocket.WebSocketHandler" ]
import org.webmessage.handler.websocket.WebSocketHandler;
import org.webmessage.handler.websocket.*;
[ "org.webmessage.handler" ]
org.webmessage.handler;
389,240
@Nullable public static Method getMethod(Class<?> clazz, String name, Class[] parameterTypes) { for (Method m : getMethods(clazz)) { if (m.getName().equals(name)) { Class[] paramA = m.getParameterTypes(); if (Arrays.equals(parameterTypes, paramA)) { return m; } } } return null; } /** * See {@link Clazz#getFields(Class)}
static Method function(Class<?> clazz, String name, Class[] parameterTypes) { for (Method m : getMethods(clazz)) { if (m.getName().equals(name)) { Class[] paramA = m.getParameterTypes(); if (Arrays.equals(parameterTypes, paramA)) { return m; } } } return null; } /** * See {@link Clazz#getFields(Class)}
/** * Returns the method from the class or any super class which matches the given signature * * @param clazz * @return */
Returns the method from the class or any super class which matches the given signature
getMethod
{ "repo_name": "worldiety/homunculus", "path": "hcf-core/src/main/java/org/homunculusframework/lang/Reflection.java", "license": "apache-2.0", "size": 7857 }
[ "java.lang.reflect.Method", "java.util.Arrays" ]
import java.lang.reflect.Method; import java.util.Arrays;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,690,585
protected String getDataTypeRepresentation(DataType dataType, int width, int scale) { return getColumnRepresentation(dataType, width, scale); }
String function(DataType dataType, int width, int scale) { return getColumnRepresentation(dataType, width, scale); }
/** * Gets the column representation for the datatype, etc. * * @param dataType the column datatype. * @param width the column width. * @param scale the column scale. * @return a string representation of the column definition. */
Gets the column representation for the datatype, etc
getDataTypeRepresentation
{ "repo_name": "alfasoftware/morf", "path": "morf-core/src/main/java/org/alfasoftware/morf/jdbc/SqlDialect.java", "license": "apache-2.0", "size": 144949 }
[ "org.alfasoftware.morf.metadata.DataType" ]
import org.alfasoftware.morf.metadata.DataType;
import org.alfasoftware.morf.metadata.*;
[ "org.alfasoftware.morf" ]
org.alfasoftware.morf;
1,483,879
public static String formatInput(Replaceable input, Transliterator.Position pos) { return formatInput((ReplaceableString) input, pos); }
static String function(Replaceable input, Transliterator.Position pos) { return formatInput((ReplaceableString) input, pos); }
/** * Convenience method. */
Convenience method
formatInput
{ "repo_name": "mirego/j2objc", "path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UtilityExtensions.java", "license": "apache-2.0", "size": 4601 }
[ "android.icu.text.Replaceable", "android.icu.text.ReplaceableString", "android.icu.text.Transliterator" ]
import android.icu.text.Replaceable; import android.icu.text.ReplaceableString; import android.icu.text.Transliterator;
import android.icu.text.*;
[ "android.icu" ]
android.icu;
821,278
public Formatter getLongFormatter() { return new NumberFormatter(21, 0); }
Formatter function() { return new NumberFormatter(21, 0); }
/** * Returns a formatter to format longs. * * @return a new formatter. */
Returns a formatter to format longs
getLongFormatter
{ "repo_name": "scgray/jsqsh", "path": "jsqsh-core/src/main/java/org/sqsh/DataFormatter.java", "license": "apache-2.0", "size": 14248 }
[ "org.sqsh.format.NumberFormatter" ]
import org.sqsh.format.NumberFormatter;
import org.sqsh.format.*;
[ "org.sqsh.format" ]
org.sqsh.format;
1,289,032
public void checkIfSuccessOrWait() throws NoResponseException { connectionLock.lock(); try { if (state == State.Success) { // Return immediately return; } waitForConditionOrTimeout(); } finally { connectionLock.unlock(); } checkForResponse(); }
void function() throws NoResponseException { connectionLock.lock(); try { if (state == State.Success) { return; } waitForConditionOrTimeout(); } finally { connectionLock.unlock(); } checkForResponse(); }
/** * Check if this synchronization point is successful or wait the connections reply timeout. * @throws NoResponseException if there was no response marking the synchronization point as success or failed. */
Check if this synchronization point is successful or wait the connections reply timeout
checkIfSuccessOrWait
{ "repo_name": "Soo000/SooChat", "path": "src/org/jivesoftware/smack/SynchronizationPoint.java", "license": "apache-2.0", "size": 8877 }
[ "org.jivesoftware.smack.SmackException" ]
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.*;
[ "org.jivesoftware.smack" ]
org.jivesoftware.smack;
365,385
public void testNotOne() { byte rBytes[] = {-2}; BigInteger aNumber = BigInteger.ONE; BigInteger result = aNumber.not(); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign", -1, result.signum()); }
void function() { byte rBytes[] = {-2}; BigInteger aNumber = BigInteger.ONE; BigInteger result = aNumber.not(); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, -1, result.signum()); }
/** * Not for ONE */
Not for ONE
testNotOne
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java", "license": "gpl-2.0", "size": 7641 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,260,293
public Object encode(Object raw) throws EncoderException { if (!(raw instanceof byte[])) { throw new EncoderException("argument not a byte array"); } return toAsciiChars((byte[]) raw); }
Object function(Object raw) throws EncoderException { if (!(raw instanceof byte[])) { throw new EncoderException(STR); } return toAsciiChars((byte[]) raw); }
/** * Converts an array of raw binary data into an array of ASCII 0 and 1 chars. * * @param raw * the raw binary data to convert * @return 0 and 1 ASCII character chars one for each bit of the argument * @throws EncoderException * if the argument is not a byte[] * @see org.mozilla.apache.commons.codec.Encoder#encode(Object) */
Converts an array of raw binary data into an array of ASCII 0 and 1 chars
encode
{ "repo_name": "mcomella/FirefoxAccounts-android", "path": "thirdparty/src/main/java/org/mozilla/apache/commons/codec/binary/BinaryCodec.java", "license": "mpl-2.0", "size": 11025 }
[ "org.mozilla.apache.commons.codec.EncoderException" ]
import org.mozilla.apache.commons.codec.EncoderException;
import org.mozilla.apache.commons.codec.*;
[ "org.mozilla.apache" ]
org.mozilla.apache;
1,988,842
public IntDoublePair poll() { if (isEmpty()) { return null; } IntDoublePair poll = peek(); int lastIndex = _values.size() - 1; swapValues(0, lastIndex); _values.removeDouble(lastIndex); _keyToIndexMap.remove(_indexToKeyMap.get(lastIndex)); _indexToKeyMap.remove(lastIndex); if (!_values.isEmpty()) { siftDown(0); } return poll; }
IntDoublePair function() { if (isEmpty()) { return null; } IntDoublePair poll = peek(); int lastIndex = _values.size() - 1; swapValues(0, lastIndex); _values.removeDouble(lastIndex); _keyToIndexMap.remove(_indexToKeyMap.get(lastIndex)); _indexToKeyMap.remove(lastIndex); if (!_values.isEmpty()) { siftDown(0); } return poll; }
/** * Returns the key+value pair with the max priority (min for minHeap mode) * <ul> * <li> key+value pair is removed from the priority queue. </li> * <li> Returns null if the priority queue is empty. </li> * <li> Runtime complexity of O(1). </li> * </ul> * * @return Key+Value pair */
Returns the key+value pair with the max priority (min for minHeap mode) key+value pair is removed from the priority queue. Returns null if the priority queue is empty. Runtime complexity of O(1).
poll
{ "repo_name": "linkedin/pinot", "path": "pinot-core/src/main/java/org/apache/pinot/core/util/IntDoubleIndexedPriorityQueue.java", "license": "apache-2.0", "size": 8548 }
[ "org.apache.pinot.common.utils.Pairs" ]
import org.apache.pinot.common.utils.Pairs;
import org.apache.pinot.common.utils.*;
[ "org.apache.pinot" ]
org.apache.pinot;
1,621,165
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.writeObject(sourceId); out.writeObject(destinationId); out.writeObject(flavourText); }
void function(java.io.ObjectOutputStream out) throws IOException { out.writeObject(sourceId); out.writeObject(destinationId); out.writeObject(flavourText); }
/** * Writes the Serializable attributes of the Choice object. * * @param out * ObjectOutputStream to write with * @throws IOException */
Writes the Serializable attributes of the Choice object
writeObject
{ "repo_name": "CMPUT301F13T01/CreateYourOwnAdventure", "path": "CreateYourOwnAdventure/src/cmput301/f13t01/model/Choice.java", "license": "gpl-3.0", "size": 4341 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,230,608
protected void askForAdbRestart(ITaskMonitor monitor) { // Restart ADB if we don't need to ask. if (!getSettingsController().getSettings().getAskBeforeAdbRestart()) { AdbWrapper adb = new AdbWrapper(getOsSdkRoot(), monitor); adb.stopAdb(); adb.startAdb(); } }
void function(ITaskMonitor monitor) { if (!getSettingsController().getSettings().getAskBeforeAdbRestart()) { AdbWrapper adb = new AdbWrapper(getOsSdkRoot(), monitor); adb.stopAdb(); adb.startAdb(); } }
/** * Attempts to restart ADB. * <p/> * If the "ask before restart" setting is set (the default), prompt the user whether * now is a good time to restart ADB. */
Attempts to restart ADB. If the "ask before restart" setting is set (the default), prompt the user whether now is a good time to restart ADB
askForAdbRestart
{ "repo_name": "consulo/consulo-android", "path": "tools-base/sdklib/src/main/java/com/android/sdklib/internal/repository/updater/UpdaterData.java", "license": "apache-2.0", "size": 53217 }
[ "com.android.sdklib.internal.repository.AdbWrapper", "com.android.sdklib.internal.repository.ITaskMonitor" ]
import com.android.sdklib.internal.repository.AdbWrapper; import com.android.sdklib.internal.repository.ITaskMonitor;
import com.android.sdklib.internal.repository.*;
[ "com.android.sdklib" ]
com.android.sdklib;
1,388,097
return Constants.NAMESPACE + "spatialOverlaps"; }
return Constants.NAMESPACE + STR; }
/** * return the URI */
return the URI
getURI
{ "repo_name": "tkurz/sparql-mm", "path": "src/main/java/com/github/tkurz/sparqlmm/function/spatial/relation/topological/SpatialOverlapsFunction.java", "license": "apache-2.0", "size": 1711 }
[ "com.github.tkurz.sparqlmm.Constants" ]
import com.github.tkurz.sparqlmm.Constants;
import com.github.tkurz.sparqlmm.*;
[ "com.github.tkurz" ]
com.github.tkurz;
56,194
public void establishColor(StringBuffer codeBuffer, Color color, boolean fill) { if (color instanceof ColorWithAlternatives) { ColorWithAlternatives colExt = (ColorWithAlternatives)color; //Alternate colors have priority Color[] alt = colExt.getAlternativeColors(); for (int i = 0, c = alt.length; i < c; i++) { Color col = alt[i]; boolean established = establishColorFromColor(codeBuffer, col, fill); if (established) { return; } } if (log.isDebugEnabled() && alt.length > 0) { log.debug("None of the alternative colors are supported. Using fallback: " + color); } } //Fallback boolean established = establishColorFromColor(codeBuffer, color, fill); if (!established) { establishDeviceRGB(codeBuffer, color, fill); } }
void function(StringBuffer codeBuffer, Color color, boolean fill) { if (color instanceof ColorWithAlternatives) { ColorWithAlternatives colExt = (ColorWithAlternatives)color; Color[] alt = colExt.getAlternativeColors(); for (int i = 0, c = alt.length; i < c; i++) { Color col = alt[i]; boolean established = establishColorFromColor(codeBuffer, col, fill); if (established) { return; } } if (log.isDebugEnabled() && alt.length > 0) { log.debug(STR + color); } } boolean established = establishColorFromColor(codeBuffer, color, fill); if (!established) { establishDeviceRGB(codeBuffer, color, fill); } }
/** * Generates code to select the given color and handles the registration of color spaces in * PDF where necessary. * @param codeBuffer the target buffer to receive the color selection code * @param color the color * @param fill true for fill color, false for stroke color */
Generates code to select the given color and handles the registration of color spaces in PDF where necessary
establishColor
{ "repo_name": "Distrotech/fop", "path": "src/java/org/apache/fop/pdf/PDFColorHandler.java", "license": "apache-2.0", "size": 9462 }
[ "java.awt.Color", "org.apache.xmlgraphics.java2d.color.ColorWithAlternatives" ]
import java.awt.Color; import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives;
import java.awt.*; import org.apache.xmlgraphics.java2d.color.*;
[ "java.awt", "org.apache.xmlgraphics" ]
java.awt; org.apache.xmlgraphics;
1,133,233
public List<String> getUsedVariables() { // Get the list of Strings. List<StringSearchResult> stringList = getStringList( true, true, false, true ); List<String> varList = new ArrayList<String>(); // Look around in the strings, see what we find... for ( int i = 0; i < stringList.size(); i++ ) { StringSearchResult result = stringList.get( i ); StringUtil.getUsedVariables( result.getString(), varList, false ); } return varList; }
List<String> function() { List<StringSearchResult> stringList = getStringList( true, true, false, true ); List<String> varList = new ArrayList<String>(); for ( int i = 0; i < stringList.size(); i++ ) { StringSearchResult result = stringList.get( i ); StringUtil.getUsedVariables( result.getString(), varList, false ); } return varList; }
/** * Gets a list of the used variables in this transformation. * * @return a list of the used variables in this transformation. */
Gets a list of the used variables in this transformation
getUsedVariables
{ "repo_name": "airy-ict/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 219546 }
[ "java.util.ArrayList", "java.util.List", "org.pentaho.di.core.reflection.StringSearchResult", "org.pentaho.di.core.util.StringUtil" ]
import java.util.ArrayList; import java.util.List; import org.pentaho.di.core.reflection.StringSearchResult; import org.pentaho.di.core.util.StringUtil;
import java.util.*; import org.pentaho.di.core.reflection.*; import org.pentaho.di.core.util.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
457,716
@BeforeClass public static void setup() { config = new ChangePasswordServer(); store = new MapPrincipalStoreImpl(); handler = new ChangePasswordProtocolHandler( config, store ); }
static void function() { config = new ChangePasswordServer(); store = new MapPrincipalStoreImpl(); handler = new ChangePasswordProtocolHandler( config, store ); }
/** * Creates a new instance of ChangepwProtocolHandlerTest. */
Creates a new instance of ChangepwProtocolHandlerTest
setup
{ "repo_name": "drankye/directory-server", "path": "protocol-changepw/src/test/java/org/apache/directory/server/changepw/protocol/ChangepwProtocolHandlerTest.java", "license": "apache-2.0", "size": 14596 }
[ "org.apache.directory.server.changepw.ChangePasswordServer" ]
import org.apache.directory.server.changepw.ChangePasswordServer;
import org.apache.directory.server.changepw.*;
[ "org.apache.directory" ]
org.apache.directory;
1,476,186
public Iterator<User> getAllUsers(Filter<User> userFilter) throws StoreException;
Iterator<User> function(Filter<User> userFilter) throws StoreException;
/** * Returns an iterator which can be used to iterate over the list of users available in this User Database. An optional filter * can be provided to limit the result set. * * @param userFilter * Filter to use to limit the returned result set, or <code>null</code> to not apply a filter. * * @return An iterator over the (optionally filtered) set of users available in this User Database, possibly not providing any * elements, but never <code>null</code>. * @throws StoreException * If any I/O exception occurs when querying the underlying persistence store. */
Returns an iterator which can be used to iterate over the list of users available in this User Database. An optional filter can be provided to limit the result set
getAllUsers
{ "repo_name": "AludraTest/cloud-manager-api", "path": "src/main/java/org/aludratest/cloud/user/UserDatabase.java", "license": "apache-2.0", "size": 7002 }
[ "java.util.Iterator", "org.databene.commons.Filter" ]
import java.util.Iterator; import org.databene.commons.Filter;
import java.util.*; import org.databene.commons.*;
[ "java.util", "org.databene.commons" ]
java.util; org.databene.commons;
442,216
public final void postConstruct() { if (getType() == null) { throw new IllegalArgumentException("invalid scalebar type: " + this.type); } if (this.unit != null && DistanceUnit.fromString(this.unit) == null) { throw new IllegalArgumentException("invalid unit: " + this.unit); } if (this.intervals < 1) { throw new IllegalArgumentException("invalid number of intervals: " + this.intervals); } if (this.color != null && !ColorParser.canParseColor(this.color)) { throw new IllegalArgumentException("invalid color: " + this.color); } if (this.fontColor != null && !ColorParser.canParseColor(this.fontColor)) { throw new IllegalArgumentException("invalid font color: " + this.fontColor); } if (this.barBgColor != null && !ColorParser.canParseColor(this.barBgColor)) { throw new IllegalArgumentException("invalid bar background color: " + this.barBgColor); } if (this.backgroundColor != null && !ColorParser.canParseColor(this.backgroundColor)) { throw new IllegalArgumentException("invalid background color: " + this.backgroundColor); } if (getOrientation() == null) { throw new IllegalArgumentException("invalid scalebar orientation: " + this.orientation); } if (getAlign() == null) { throw new IllegalArgumentException("invalid align: " + this.align); } if (getVerticalAlign() == null) { throw new IllegalArgumentException("invalid verticalAlign: " + this.verticalAlign); } }
final void function() { if (getType() == null) { throw new IllegalArgumentException(STR + this.type); } if (this.unit != null && DistanceUnit.fromString(this.unit) == null) { throw new IllegalArgumentException(STR + this.unit); } if (this.intervals < 1) { throw new IllegalArgumentException(STR + this.intervals); } if (this.color != null && !ColorParser.canParseColor(this.color)) { throw new IllegalArgumentException(STR + this.color); } if (this.fontColor != null && !ColorParser.canParseColor(this.fontColor)) { throw new IllegalArgumentException(STR + this.fontColor); } if (this.barBgColor != null && !ColorParser.canParseColor(this.barBgColor)) { throw new IllegalArgumentException(STR + this.barBgColor); } if (this.backgroundColor != null && !ColorParser.canParseColor(this.backgroundColor)) { throw new IllegalArgumentException(STR + this.backgroundColor); } if (getOrientation() == null) { throw new IllegalArgumentException(STR + this.orientation); } if (getAlign() == null) { throw new IllegalArgumentException(STR + this.align); } if (getVerticalAlign() == null) { throw new IllegalArgumentException(STR + this.verticalAlign); } }
/** * Initialize default values and validate that the config is correct. */
Initialize default values and validate that the config is correct
postConstruct
{ "repo_name": "mapfish/mapfish-print", "path": "core/src/main/java/org/mapfish/print/attribute/ScalebarAttribute.java", "license": "bsd-2-clause", "size": 13989 }
[ "org.mapfish.print.map.DistanceUnit", "org.mapfish.print.map.style.json.ColorParser" ]
import org.mapfish.print.map.DistanceUnit; import org.mapfish.print.map.style.json.ColorParser;
import org.mapfish.print.map.*; import org.mapfish.print.map.style.json.*;
[ "org.mapfish.print" ]
org.mapfish.print;
1,881,381
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<ConfigurationListResultInner> batchUpdateAsync( String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { return beginBatchUpdateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ConfigurationListResultInner> function( String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { return beginBatchUpdateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Update a list of configurations in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param parameters The parameters for updating a list of server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of server configurations on successful completion of {@link Mono}. */
Update a list of configurations in a given server
batchUpdateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsClientImpl.java", "license": "mit", "size": 57583 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner", "com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.*; import com.azure.resourcemanager.mysqlflexibleserver.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,705,504
void removeTagDescription(SecurityContext ctx, long tagID, long userID) throws DSOutOfServiceException, DSAccessException { Connector c = getConnector(ctx, true, false); try { IQueryPrx service = c.getQueryService(); String type = "ome.model.annotations.TextAnnotation"; ParametersI param = new ParametersI(); param.addLong("uid", userID); param.addLong("id", tagID); String sql = "select link from AnnotationAnnotationLink as link "; sql += "where link.parent.id = :id"; sql += " and link.child member of "+type; sql += " and link.details.owner.id = :uid"; List l = service.findAllByQuery(sql, param); //remove all the links if any if (l != null) { Iterator i = l.iterator(); AnnotationAnnotationLink link; IObject child; while (i.hasNext()) { link = (AnnotationAnnotationLink) i.next(); child = link.getChild(); if (!((child instanceof TagAnnotation) || (child instanceof TermAnnotation))) { deleteObject(ctx, link); deleteObject(ctx, child); } } } } catch (Exception e) { handleException(e, "Cannot remove the tag description."); } }
void removeTagDescription(SecurityContext ctx, long tagID, long userID) throws DSOutOfServiceException, DSAccessException { Connector c = getConnector(ctx, true, false); try { IQueryPrx service = c.getQueryService(); String type = STR; ParametersI param = new ParametersI(); param.addLong("uid", userID); param.addLong("id", tagID); String sql = STR; sql += STR; sql += STR+type; sql += STR; List l = service.findAllByQuery(sql, param); if (l != null) { Iterator i = l.iterator(); AnnotationAnnotationLink link; IObject child; while (i.hasNext()) { link = (AnnotationAnnotationLink) i.next(); child = link.getChild(); if (!((child instanceof TagAnnotation) (child instanceof TermAnnotation))) { deleteObject(ctx, link); deleteObject(ctx, child); } } } } catch (Exception e) { handleException(e, STR); } }
/** * Removes the description linked to the tags. * * @param ctx The security context. * @param tagID The id of tag to handle. * @param userID The id of the user who annotated the tag. * @throws DSOutOfServiceException If the connection is broken, or logged * in. * @throws DSAccessException If an error occurred while trying to * retrieve data from OMEDS service. */
Removes the description linked to the tags
removeTagDescription
{ "repo_name": "jballanc/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java", "license": "gpl-2.0", "size": 286379 }
[ "java.util.Iterator", "java.util.List", "org.openmicroscopy.shoola.env.data.util.SecurityContext" ]
import java.util.Iterator; import java.util.List; import org.openmicroscopy.shoola.env.data.util.SecurityContext;
import java.util.*; import org.openmicroscopy.shoola.env.data.util.*;
[ "java.util", "org.openmicroscopy.shoola" ]
java.util; org.openmicroscopy.shoola;
2,598,197
public byte[] take() throws KeeperException, InterruptedException { TreeMap<Long,String> orderedChildren; // Same as for element. Should refactor this. while(true){ LatchChildWatcher childWatcher = new LatchChildWatcher(); try{ orderedChildren = orderedChildren(childWatcher); }catch(KeeperException.NoNodeException e){ zookeeper.create(dir, new byte[0], acl, CreateMode.PERSISTENT); continue; } if(orderedChildren.size() == 0){ childWatcher.await(); continue; } for(String headNode : orderedChildren.values()){ String path = dir +"/"+headNode; try{ byte[] data = zookeeper.getData(path, false, null); zookeeper.delete(path, -1); return data; }catch(KeeperException.NoNodeException e){ // Another client deleted the node first. } } } }
byte[] function() throws KeeperException, InterruptedException { TreeMap<Long,String> orderedChildren; while(true){ LatchChildWatcher childWatcher = new LatchChildWatcher(); try{ orderedChildren = orderedChildren(childWatcher); }catch(KeeperException.NoNodeException e){ zookeeper.create(dir, new byte[0], acl, CreateMode.PERSISTENT); continue; } if(orderedChildren.size() == 0){ childWatcher.await(); continue; } for(String headNode : orderedChildren.values()){ String path = dir +"/"+headNode; try{ byte[] data = zookeeper.getData(path, false, null); zookeeper.delete(path, -1); return data; }catch(KeeperException.NoNodeException e){ } } } }
/** * Removes the head of the queue and returns it, blocks until it succeeds. * @return The former head of the queue * @throws NoSuchElementException * @throws KeeperException * @throws InterruptedException */
Removes the head of the queue and returns it, blocks until it succeeds
take
{ "repo_name": "helpshift/zk-queue", "path": "src/java/org/apache/zookeeper/recipes/queue/DistributedQueue.java", "license": "apache-2.0", "size": 10707 }
[ "java.util.TreeMap", "org.apache.zookeeper.CreateMode", "org.apache.zookeeper.KeeperException" ]
import java.util.TreeMap; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException;
import java.util.*; import org.apache.zookeeper.*;
[ "java.util", "org.apache.zookeeper" ]
java.util; org.apache.zookeeper;
2,113,266
@Override public void setLexicalHandler(@SuppressWarnings("unused") final LexicalHandler handler) { // } // ========================================================================= // FragmentHandler nested class // ========================================================================= private static class FragmentHandler extends SAXHandler { private final Element dummyRoot = new Element("root", null, null); public FragmentHandler(final JDOMFactory factory) { super(factory); // Add a dummy root element to the being-built document as XSL // transformation can output node lists instead of well-formed // documents. this.pushElement(this.dummyRoot); }
void function(@SuppressWarnings(STR) final LexicalHandler handler) { } private static class FragmentHandler extends SAXHandler { private final Element dummyRoot = new Element("root", null, null); public FragmentHandler(final JDOMFactory factory) { super(factory); this.pushElement(this.dummyRoot); }
/** * Sets the SAX2 LexicalHandler for the output. * <p> * This is needed to handle XML comments and the like. If the lexical * handler is not set, an attempt should be made by the transformer to cast * the ContentHandler to a LexicalHandler. * </p> * * @param handler * A non-null LexicalHandler for handling lexical parse events. */
Sets the SAX2 LexicalHandler for the output. This is needed to handle XML comments and the like. If the lexical handler is not set, an attempt should be made by the transformer to cast the ContentHandler to a LexicalHandler.
setLexicalHandler
{ "repo_name": "autermann/geosoftware", "path": "src/test/java/jdom/transform/JDOMResult.java", "license": "gpl-3.0", "size": 23257 }
[ "jdom.input.SAXHandler", "org.xml.sax.ext.LexicalHandler" ]
import jdom.input.SAXHandler; import org.xml.sax.ext.LexicalHandler;
import jdom.input.*; import org.xml.sax.ext.*;
[ "jdom.input", "org.xml.sax" ]
jdom.input; org.xml.sax;
2,552,316
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ChartUtil.awtProblemCause != null) { // not available. send out error message rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); return; } AbstractBuild<?, ?> build = getOwner(); Calendar t = build.getTimestamp(); if (req.checkIfModified(t, rsp)) { return; // up to date } JFreeChart chart = new CoverageChart(this).createChart(); ChartUtil.generateGraph(req, rsp, chart, 500, 200); }
void function(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ChartUtil.awtProblemCause != null) { rsp.sendRedirect2(req.getContextPath() + STR); return; } AbstractBuild<?, ?> build = getOwner(); Calendar t = build.getTimestamp(); if (req.checkIfModified(t, rsp)) { return; } JFreeChart chart = new CoverageChart(this).createChart(); ChartUtil.generateGraph(req, rsp, chart, 500, 200); }
/** * Generates the graph that shows the coverage trend up to this report. */
Generates the graph that shows the coverage trend up to this report
doGraph
{ "repo_name": "arcivanov/cobertura-plugin", "path": "src/main/java/hudson/plugins/cobertura/targets/CoverageResult.java", "license": "mit", "size": 15672 }
[ "hudson.model.AbstractBuild", "hudson.plugins.cobertura.CoverageChart", "hudson.util.ChartUtil", "java.io.IOException", "java.util.Calendar", "org.jfree.chart.JFreeChart", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import hudson.model.AbstractBuild; import hudson.plugins.cobertura.CoverageChart; import hudson.util.ChartUtil; import java.io.IOException; import java.util.Calendar; import org.jfree.chart.JFreeChart; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import hudson.model.*; import hudson.plugins.cobertura.*; import hudson.util.*; import java.io.*; import java.util.*; import org.jfree.chart.*; import org.kohsuke.stapler.*;
[ "hudson.model", "hudson.plugins.cobertura", "hudson.util", "java.io", "java.util", "org.jfree.chart", "org.kohsuke.stapler" ]
hudson.model; hudson.plugins.cobertura; hudson.util; java.io; java.util; org.jfree.chart; org.kohsuke.stapler;
2,613,735
public static CxxPlatform copyPlatformWithFlavorAndConfig( CxxPlatform defaultPlatform, CxxBuckConfig config, Flavor flavor ) { CxxPlatform.Builder builder = CxxPlatform.builder(); builder .setFlavor(flavor) .setAs(getTool(flavor, "as", config).or(defaultPlatform.getAs())) .setAspp( getTool(flavor, "aspp", config) .transform(getPreprocessor(defaultPlatform.getAspp().getClass())) .or(defaultPlatform.getAspp())) .setCc( getTool(flavor, "cc", config) .transform(getCompiler(defaultPlatform.getCc().getClass())) .or(defaultPlatform.getCc())) .setCxx( getTool(flavor, "cxx", config) .transform(getCompiler(defaultPlatform.getCxx().getClass())) .or(defaultPlatform.getCxx())) .setCpp( getTool(flavor, "cpp", config) .transform(getPreprocessor(defaultPlatform.getCpp().getClass())) .or(defaultPlatform.getCpp())) .setCxxpp( getTool(flavor, "cxxpp", config) .transform(getPreprocessor(defaultPlatform.getCxxpp().getClass())) .or(defaultPlatform.getCxxpp())) .setLd( getTool(flavor, "ld", config) .transform(getLinker(defaultPlatform.getLd().getClass(), config)) .or(defaultPlatform.getLd())) .setAr(getTool(flavor, "ar", config) .transform(getArchiver(defaultPlatform.getAr().getClass(), config)) .or(defaultPlatform.getAr())) .setRanlib(getTool(flavor, "ranlib", config).or(defaultPlatform.getRanlib())) .setStrip(getTool(flavor, "strip", config).or(defaultPlatform.getStrip())) .setSharedLibraryExtension(defaultPlatform.getSharedLibraryExtension()) .setSharedLibraryVersionedExtensionFormat( defaultPlatform.getSharedLibraryVersionedExtensionFormat()) .setDebugPathSanitizer(defaultPlatform.getDebugPathSanitizer()); if (config.getDefaultPlatform().isPresent()) { // Try to add the tool flags from the default platform CxxPlatforms.addToolFlagsFromCxxPlatform(builder, defaultPlatform); } CxxPlatforms.addToolFlagsFromConfig(config, builder); return builder.build(); }
static CxxPlatform function( CxxPlatform defaultPlatform, CxxBuckConfig config, Flavor flavor ) { CxxPlatform.Builder builder = CxxPlatform.builder(); builder .setFlavor(flavor) .setAs(getTool(flavor, "as", config).or(defaultPlatform.getAs())) .setAspp( getTool(flavor, "aspp", config) .transform(getPreprocessor(defaultPlatform.getAspp().getClass())) .or(defaultPlatform.getAspp())) .setCc( getTool(flavor, "cc", config) .transform(getCompiler(defaultPlatform.getCc().getClass())) .or(defaultPlatform.getCc())) .setCxx( getTool(flavor, "cxx", config) .transform(getCompiler(defaultPlatform.getCxx().getClass())) .or(defaultPlatform.getCxx())) .setCpp( getTool(flavor, "cpp", config) .transform(getPreprocessor(defaultPlatform.getCpp().getClass())) .or(defaultPlatform.getCpp())) .setCxxpp( getTool(flavor, "cxxpp", config) .transform(getPreprocessor(defaultPlatform.getCxxpp().getClass())) .or(defaultPlatform.getCxxpp())) .setLd( getTool(flavor, "ld", config) .transform(getLinker(defaultPlatform.getLd().getClass(), config)) .or(defaultPlatform.getLd())) .setAr(getTool(flavor, "ar", config) .transform(getArchiver(defaultPlatform.getAr().getClass(), config)) .or(defaultPlatform.getAr())) .setRanlib(getTool(flavor, STR, config).or(defaultPlatform.getRanlib())) .setStrip(getTool(flavor, "strip", config).or(defaultPlatform.getStrip())) .setSharedLibraryExtension(defaultPlatform.getSharedLibraryExtension()) .setSharedLibraryVersionedExtensionFormat( defaultPlatform.getSharedLibraryVersionedExtensionFormat()) .setDebugPathSanitizer(defaultPlatform.getDebugPathSanitizer()); if (config.getDefaultPlatform().isPresent()) { CxxPlatforms.addToolFlagsFromCxxPlatform(builder, defaultPlatform); } CxxPlatforms.addToolFlagsFromConfig(config, builder); return builder.build(); }
/** * Creates a CxxPlatform with a defined flavor for a CxxBuckConfig with default values * provided from another default CxxPlatform */
Creates a CxxPlatform with a defined flavor for a CxxBuckConfig with default values provided from another default CxxPlatform
copyPlatformWithFlavorAndConfig
{ "repo_name": "Distrotech/buck", "path": "src/com/facebook/buck/cxx/CxxPlatforms.java", "license": "apache-2.0", "size": 12387 }
[ "com.facebook.buck.model.Flavor" ]
import com.facebook.buck.model.Flavor;
import com.facebook.buck.model.*;
[ "com.facebook.buck" ]
com.facebook.buck;
1,488,484
@Test public void removesRequestAndWire() throws IOException { final MkGithub github = new MkGithub(); final Repo repo = github.randomRepo(); final Talk talk = DephantomizesTest.talk(repo, 0); new Dephantomizes(github).execute(talk); MatcherAssert.assertThat( talk.read(), XhtmlMatchers.hasXPath("/talk[not(request) and not(wire)]") ); }
void function() throws IOException { final MkGithub github = new MkGithub(); final Repo repo = github.randomRepo(); final Talk talk = DephantomizesTest.talk(repo, 0); new Dephantomizes(github).execute(talk); MatcherAssert.assertThat( talk.read(), XhtmlMatchers.hasXPath(STR) ); }
/** * Dephantomizes can remove request and wire. * @throws IOException In case of error */
Dephantomizes can remove request and wire
removesRequestAndWire
{ "repo_name": "krzyk/rultor", "path": "src/test/java/com/rultor/agents/github/DephantomizesTest.java", "license": "bsd-3-clause", "size": 3915 }
[ "com.jcabi.github.Repo", "com.jcabi.github.mock.MkGithub", "com.jcabi.matchers.XhtmlMatchers", "com.rultor.spi.Talk", "java.io.IOException", "org.hamcrest.MatcherAssert" ]
import com.jcabi.github.Repo; import com.jcabi.github.mock.MkGithub; import com.jcabi.matchers.XhtmlMatchers; import com.rultor.spi.Talk; import java.io.IOException; import org.hamcrest.MatcherAssert;
import com.jcabi.github.*; import com.jcabi.github.mock.*; import com.jcabi.matchers.*; import com.rultor.spi.*; import java.io.*; import org.hamcrest.*;
[ "com.jcabi.github", "com.jcabi.matchers", "com.rultor.spi", "java.io", "org.hamcrest" ]
com.jcabi.github; com.jcabi.matchers; com.rultor.spi; java.io; org.hamcrest;
2,084,544
public void scale(double scaleX, double scaleY) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.scale((float) scaleX, (float) scaleY); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
void function(double scaleX, double scaleY) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.scale((float) scaleX, (float) scaleY); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
/** * Applies a scale transform. * * @param scaleX the scale factor along the x-axis. * @param scaleY the scale factor along the y-axis. */
Applies a scale transform
scale
{ "repo_name": "int32at/sweaty", "path": "src/src/at/int32/sweaty/ui/utils/SWTGraphics2D.java", "license": "mit", "size": 43576 }
[ "org.eclipse.swt.graphics.Transform" ]
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,219,572
public synchronized void close() { if (!isConnected()) { // Not connected - just return (can be cleanup "for sure") return; } try { mInput.close(); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, "input close failure", e); } try { mOutput.close(); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, "output close failure", e); } try { mSocket.close(); if(Logging.DEBUG) Log.d(Logging.TAG, "close() - Socket closed"); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, "socket close failure", e); } mSocket = null; }
synchronized void function() { if (!isConnected()) { return; } try { mInput.close(); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, STR, e); } try { mOutput.close(); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, STR, e); } try { mSocket.close(); if(Logging.DEBUG) Log.d(Logging.TAG, STR); } catch (IOException e) { if(Logging.WARNING) Log.w(Logging.TAG, STR, e); } mSocket = null; }
/** * Closes the currently opened connection to BOINC core client */
Closes the currently opened connection to BOINC core client
close
{ "repo_name": "hanxue/Boinc", "path": "android/BOINC/src/edu/berkeley/boinc/rpc/RpcClient.java", "license": "gpl-3.0", "size": 44635 }
[ "android.util.Log", "edu.berkeley.boinc.utils.Logging", "java.io.IOException" ]
import android.util.Log; import edu.berkeley.boinc.utils.Logging; import java.io.IOException;
import android.util.*; import edu.berkeley.boinc.utils.*; import java.io.*;
[ "android.util", "edu.berkeley.boinc", "java.io" ]
android.util; edu.berkeley.boinc; java.io;
140,571
public Collection ejbFindAllCaseLogsByCaseOrderedByDate(Case aCase) throws FinderException { Table table = new Table(this); SelectQuery query = new SelectQuery(table); query.addColumn(new WildCardColumn()); query.addCriteria(new MatchCriteria(table, COLUMN_CASE_ID, MatchCriteria.EQUALS, aCase)); query.addOrder(table, COLUMN_TIMESTAMP, false); return super.idoFindPKsByQuery(query); }
Collection function(Case aCase) throws FinderException { Table table = new Table(this); SelectQuery query = new SelectQuery(table); query.addColumn(new WildCardColumn()); query.addCriteria(new MatchCriteria(table, COLUMN_CASE_ID, MatchCriteria.EQUALS, aCase)); query.addOrder(table, COLUMN_TIMESTAMP, false); return super.idoFindPKsByQuery(query); }
/** * Finds all CaseLogs recorded for the specified aCase */
Finds all CaseLogs recorded for the specified aCase
ejbFindAllCaseLogsByCaseOrderedByDate
{ "repo_name": "idega/platform2", "path": "src/com/idega/block/process/data/CaseLogBMPBean.java", "license": "gpl-3.0", "size": 8171 }
[ "com.idega.data.query.MatchCriteria", "com.idega.data.query.SelectQuery", "com.idega.data.query.Table", "com.idega.data.query.WildCardColumn", "java.util.Collection", "javax.ejb.FinderException" ]
import com.idega.data.query.MatchCriteria; import com.idega.data.query.SelectQuery; import com.idega.data.query.Table; import com.idega.data.query.WildCardColumn; import java.util.Collection; import javax.ejb.FinderException;
import com.idega.data.query.*; import java.util.*; import javax.ejb.*;
[ "com.idega.data", "java.util", "javax.ejb" ]
com.idega.data; java.util; javax.ejb;
2,891,433
public static ElementStore getElementStore() { return ChartController.instance.chart.getElementStore(); }
static ElementStore function() { return ChartController.instance.chart.getElementStore(); }
/** * Gets the element store and returns it. * @return the element store. */
Gets the element store and returns it
getElementStore
{ "repo_name": "kasperisager/kelvin-maps", "path": "src/main/java/dk/itu/kelvin/controller/ChartController.java", "license": "mit", "size": 17282 }
[ "dk.itu.kelvin.store.ElementStore" ]
import dk.itu.kelvin.store.ElementStore;
import dk.itu.kelvin.store.*;
[ "dk.itu.kelvin" ]
dk.itu.kelvin;
1,444,687
public List<List<IExpression>> getPaths(IExpression expression) throws MultipleRootsException { return asList(graph.getVertexPaths(getRoot(), expression)); }
List<List<IExpression>> function(IExpression expression) throws MultipleRootsException { return asList(graph.getVertexPaths(getRoot(), expression)); }
/** * To get the path of the given Expression from the root Expression. * * @param expression reference to Expression * @return the List of paths of the given Expression from root. returns * empty path list if there is no path. * @throws MultipleRootsException if more than 1 roots exists. */
To get the path of the given Expression from the root Expression
getPaths
{ "repo_name": "NCIP/cab2b", "path": "software/dependencies/query/QUERY_26_NOV_08/testQUERY_26_NOV_08/QUERY_26_NOV_08/src/edu/wustl/common/querysuite/queryobject/impl/JoinGraph.java", "license": "bsd-3-clause", "size": 14774 }
[ "edu.wustl.common.querysuite.exceptions.MultipleRootsException", "edu.wustl.common.querysuite.queryobject.IExpression", "java.util.List" ]
import edu.wustl.common.querysuite.exceptions.MultipleRootsException; import edu.wustl.common.querysuite.queryobject.IExpression; import java.util.List;
import edu.wustl.common.querysuite.exceptions.*; import edu.wustl.common.querysuite.queryobject.*; import java.util.*;
[ "edu.wustl.common", "java.util" ]
edu.wustl.common; java.util;
1,767,895
private E findClosestInBucket(int x, int y, E point) { KdTree<E> thisLatLngMap = latLngMap.get(Pair.of(x, y)); if (thisLatLngMap == null) { return null; } Collection<E> closest = thisLatLngMap.nearestNeighbourSearch(1, point); if (closest != null && closest.size() > 0) { return closest.iterator().next(); } else { return null; } }
E function(int x, int y, E point) { KdTree<E> thisLatLngMap = latLngMap.get(Pair.of(x, y)); if (thisLatLngMap == null) { return null; } Collection<E> closest = thisLatLngMap.nearestNeighbourSearch(1, point); if (closest != null && closest.size() > 0) { return closest.iterator().next(); } else { return null; } }
/** * Within the specific bucket, finds the closest point if any exists. * * @param x The x axis bucket. * @param y The y axis bucket. * @param point The point to search for. * @return The point, if any, that was found. */
Within the specific bucket, finds the closest point if any exists
findClosestInBucket
{ "repo_name": "eugene7646/autopsy", "path": "Core/src/org/sleuthkit/autopsy/datasourcesummary/datamodel/LatLngMap.java", "license": "apache-2.0", "size": 6979 }
[ "java.util.Collection", "org.apache.commons.lang3.tuple.Pair", "org.sleuthkit.autopsy.geolocation.KdTree" ]
import java.util.Collection; import org.apache.commons.lang3.tuple.Pair; import org.sleuthkit.autopsy.geolocation.KdTree;
import java.util.*; import org.apache.commons.lang3.tuple.*; import org.sleuthkit.autopsy.geolocation.*;
[ "java.util", "org.apache.commons", "org.sleuthkit.autopsy" ]
java.util; org.apache.commons; org.sleuthkit.autopsy;
1,021,288
public void testGetMessageWithMessageAlreadyLookedFor() { Object[] arguments = { new Integer(7), new Date(System.currentTimeMillis()), "a disturbance in the Force" }; // The first time searching, we don't care about for this test // Try with Locale.US sac.getMessage("message.format.example1", arguments, Locale.US); // Now msg better be as expected assertTrue("2nd search within MsgFormat cache returned expected message for Locale.US", sac.getMessage("message.format.example1", arguments, Locale.US).indexOf( "there was \"a disturbance in the Force\" on planet 7.") != -1); Object[] newArguments = { new Integer(8), new Date(System.currentTimeMillis()), "a disturbance in the Force" }; // Now msg better be as expected even with different args assertTrue("2nd search within MsgFormat cache with different args returned expected message for Locale.US", sac.getMessage("message.format.example1", newArguments, Locale.US) .indexOf("there was \"a disturbance in the Force\" on planet 8.") != -1); }
void function() { Object[] arguments = { new Integer(7), new Date(System.currentTimeMillis()), STR }; sac.getMessage(STR, arguments, Locale.US); assertTrue(STR, sac.getMessage(STR, arguments, Locale.US).indexOf( STRa disturbance in the Force\STR) != -1); Object[] newArguments = { new Integer(8), new Date(System.currentTimeMillis()), STR }; assertTrue(STR, sac.getMessage(STR, newArguments, Locale.US) .indexOf(STRa disturbance in the Force\STR) != -1); }
/** * We really are testing the AbstractMessageSource class here. * The underlying implementation uses a hashMap to cache messageFormats * once a message has been asked for. This test is an attempt to * make sure the cache is being used properly. * @see org.springframework.context.support.AbstractMessageSource for more details. */
We really are testing the AbstractMessageSource class here. The underlying implementation uses a hashMap to cache messageFormats once a message has been asked for. This test is an attempt to make sure the cache is being used properly
testGetMessageWithMessageAlreadyLookedFor
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java", "license": "apache-2.0", "size": 11009 }
[ "java.util.Date", "java.util.Locale" ]
import java.util.Date; import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
936,862
public static void deleteDenied(Plot plot) { if (plot.temp == -1) { return; } dbManager.deleteDenied(plot); }
static void function(Plot plot) { if (plot.temp == -1) { return; } dbManager.deleteDenied(plot); }
/** * Delete the denied list for a plot. * @param plot */
Delete the denied list for a plot
deleteDenied
{ "repo_name": "Maescool/PlotSquared", "path": "Core/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java", "license": "gpl-3.0", "size": 13472 }
[ "com.intellectualcrafters.plot.object.Plot" ]
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.*;
[ "com.intellectualcrafters.plot" ]
com.intellectualcrafters.plot;
2,005,864
try { return (KostenCustomBean)CidsBean.createNewCidsBeanFromTableName( LagisConstants.DOMAIN_LAGIS, LagisMetaclassConstants.KOSTEN); } catch (Exception ex) { LOG.error("error creating " + LagisMetaclassConstants.KOSTEN + " bean", ex); return null; } }
try { return (KostenCustomBean)CidsBean.createNewCidsBeanFromTableName( LagisConstants.DOMAIN_LAGIS, LagisMetaclassConstants.KOSTEN); } catch (Exception ex) { LOG.error(STR + LagisMetaclassConstants.KOSTEN + STR, ex); return null; } }
/** * DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
createNew
{ "repo_name": "cismet/lagis-client", "path": "src/main/java/de/cismet/cids/custom/beans/lagis/KostenCustomBean.java", "license": "gpl-3.0", "size": 4628 }
[ "de.cismet.cids.dynamics.CidsBean", "de.cismet.lagis.commons.LagisConstants", "de.cismet.lagis.commons.LagisMetaclassConstants" ]
import de.cismet.cids.dynamics.CidsBean; import de.cismet.lagis.commons.LagisConstants; import de.cismet.lagis.commons.LagisMetaclassConstants;
import de.cismet.cids.dynamics.*; import de.cismet.lagis.commons.*;
[ "de.cismet.cids", "de.cismet.lagis" ]
de.cismet.cids; de.cismet.lagis;
596,642
public PinotQueryGeneratorContext withFilter(String filter) { checkSupported(!hasFilter(), "There already exists a filter. Pinot doesn't support filters at multiple levels"); checkSupported(!hasAggregation(), "Pinot doesn't support filtering the results of aggregation"); checkSupported(!hasLimit(), "Pinot doesn't support filtering on top of the limit"); return new PinotQueryGeneratorContext( selections, from, Optional.of(filter), aggregations, groupByColumns, topNColumnOrderingMap, limit, variablesInAggregation, hiddenColumnSet); }
PinotQueryGeneratorContext function(String filter) { checkSupported(!hasFilter(), STR); checkSupported(!hasAggregation(), STR); checkSupported(!hasLimit(), STR); return new PinotQueryGeneratorContext( selections, from, Optional.of(filter), aggregations, groupByColumns, topNColumnOrderingMap, limit, variablesInAggregation, hiddenColumnSet); }
/** * Apply the given filter to current context and return the updated context. Throws error for invalid operations. */
Apply the given filter to current context and return the updated context. Throws error for invalid operations
withFilter
{ "repo_name": "ptkool/presto", "path": "presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/query/PinotQueryGeneratorContext.java", "license": "apache-2.0", "size": 22108 }
[ "com.facebook.presto.pinot.PinotPushdownUtils", "java.util.Optional" ]
import com.facebook.presto.pinot.PinotPushdownUtils; import java.util.Optional;
import com.facebook.presto.pinot.*; import java.util.*;
[ "com.facebook.presto", "java.util" ]
com.facebook.presto; java.util;
56,160
@Override public Vector viewRow(int row) { return new MatrixVectorView(this, row, 0, 0, 1); }
Vector function(int row) { return new MatrixVectorView(this, row, 0, 0, 1); }
/** * Returns a view of a row. Changes to the view will affect the original. * @param row Which row to return. * @return A vector that references the desired row. */
Returns a view of a row. Changes to the view will affect the original
viewRow
{ "repo_name": "christianherta/BBC-DaaS", "path": "bbcdaas_synonymLexicon/bbcdaas_synonymlexicon/src/main/java/de/bbcdaas/synonymlexicon/common/mahout/lib/AbstractMatrix.java", "license": "apache-2.0", "size": 19927 }
[ "de.bbcdaas.synonymlexicon.common.mahout.used.Vector" ]
import de.bbcdaas.synonymlexicon.common.mahout.used.Vector;
import de.bbcdaas.synonymlexicon.common.mahout.used.*;
[ "de.bbcdaas.synonymlexicon" ]
de.bbcdaas.synonymlexicon;
2,309,823
public Attribute getAttributeTypes() throws NamingException { if (schema == null) schema = getSchemaAttributes(); return (schema == null)?null:schema.get("attributeTypes"); } //XXXX - this will fail for single valued manditory attributes. //XXXX - since using 'deleteRDN = false' - 30 May 2002.
Attribute function() throws NamingException { if (schema == null) schema = getSchemaAttributes(); return (schema == null)?null:schema.get(STR); }
/** * Convenience method to get the objectClasses Attribute, which represents the syntax of * attributeTypes. * @return an Attribute with multiple values, each representing a particular attributeType * represented as complex string of values that must be parsed: e.g. the surname value might be: * 2.5.4.4 NAME ( 'sn' 'surname' ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 */
Convenience method to get the objectClasses Attribute, which represents the syntax of attributeTypes
getAttributeTypes
{ "repo_name": "idega/com.idega.block.ldap", "path": "src/java/com/idega/core/ldap/client/jndi/BasicOps.java", "license": "gpl-3.0", "size": 48723 }
[ "javax.naming.NamingException", "javax.naming.directory.Attribute" ]
import javax.naming.NamingException; import javax.naming.directory.Attribute;
import javax.naming.*; import javax.naming.directory.*;
[ "javax.naming" ]
javax.naming;
1,492,790
public int getDeletionTime() { final ProfilesDiff diff = diff(); final Set<Profile> changedProfiles = diff.getChangedProfiles(); final Set<Profile> deletedProfiles = diff.getDeletedProfiles(); final Set<String> changedProfileNames = new HashSet<>(); for (Profile p : changedProfiles) { changedProfileNames.add(p.getName()); } int time = 0; for (final ProfileMapCombination pmc : ProfileMapManager.getInstance() .getPrecalculations()) { final Profile p = pmc.getProfile(); if (changedProfileNames.contains(p.getName()) || deletedProfiles.contains(p)) { time += pmc.getCalculationTime(); } } return time; }
int function() { final ProfilesDiff diff = diff(); final Set<Profile> changedProfiles = diff.getChangedProfiles(); final Set<Profile> deletedProfiles = diff.getDeletedProfiles(); final Set<String> changedProfileNames = new HashSet<>(); for (Profile p : changedProfiles) { changedProfileNames.add(p.getName()); } int time = 0; for (final ProfileMapCombination pmc : ProfileMapManager.getInstance() .getPrecalculations()) { final Profile p = pmc.getProfile(); if (changedProfileNames.contains(p.getName()) deletedProfiles.contains(p)) { time += pmc.getCalculationTime(); } } return time; }
/** * Determines how much time the precalculations that will be deleted in * {@link #saveAllChanges()} took, in milliseconds. * * @return The deletion time, in milliseconds. */
Determines how much time the precalculations that will be deleted in <code>#saveAllChanges()</code> took, in milliseconds
getDeletionTime
{ "repo_name": "routeKIT/routeKIT", "path": "src/edu/kit/pse/ws2013/routekit/controllers/ProfileManagerController.java", "license": "gpl-3.0", "size": 9941 }
[ "edu.kit.pse.ws2013.routekit.models.ProfileMapCombination", "edu.kit.pse.ws2013.routekit.profiles.Profile", "java.util.HashSet", "java.util.Set" ]
import edu.kit.pse.ws2013.routekit.models.ProfileMapCombination; import edu.kit.pse.ws2013.routekit.profiles.Profile; import java.util.HashSet; import java.util.Set;
import edu.kit.pse.ws2013.routekit.models.*; import edu.kit.pse.ws2013.routekit.profiles.*; import java.util.*;
[ "edu.kit.pse", "java.util" ]
edu.kit.pse; java.util;
944,515
public static String logLevelFromConfig(Properties prop, String level) { String l = level; try { l = prop.getProperty("logLevel." + level); if(null == l) { l = level; System.out.println("The " + level + " is null. Please ckeck!"); } } catch(Exception e) { System.out.println("Troubles with " + level + " level. Use default vale (" + level + ")"); System.out.println(e.toString()); } return l; }
static String function(Properties prop, String level) { String l = level; try { l = prop.getProperty(STR + level); if(null == l) { l = level; System.out.println(STR + level + STR); } } catch(Exception e) { System.out.println(STR + level + STR + level + ")"); System.out.println(e.toString()); } return l; }
/** * The levels should be in the configuration file * but if they are missing the process must go on * * @param level * @return */
The levels should be in the configuration file but if they are missing the process must go on
logLevelFromConfig
{ "repo_name": "caperutxa/dimoni-parser", "path": "src/main/java/caperutxa/dimoni/parser/App.java", "license": "mit", "size": 4949 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
1,271,228
public static void removeByca(long companyId, long applicationId) throws com.liferay.portal.kernel.exception.SystemException { getPersistence().removeByca(companyId, applicationId); }
static void function(long companyId, long applicationId) throws com.liferay.portal.kernel.exception.SystemException { getPersistence().removeByca(companyId, applicationId); }
/** * Removes all the related applicationses where companyId = &#63; and applicationId = &#63; from the database. * * @param companyId the company ID * @param applicationId the application ID * @throws SystemException if a system exception occurred */
Removes all the related applicationses where companyId = &#63; and applicationId = &#63; from the database
removeByca
{ "repo_name": "fraunhoferfokus/govapps", "path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/persistence/RelatedApplicationsUtil.java", "license": "bsd-3-clause", "size": 58392 }
[ "com.liferay.portal.kernel.exception.SystemException" ]
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.exception.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,852,792
@NotNull GitFetchResult fetch(@NotNull GitRepository repository, @NotNull GitRemote remote);
GitFetchResult fetch(@NotNull GitRepository repository, @NotNull GitRemote remote);
/** * Fetches the given remote. */
Fetches the given remote
fetch
{ "repo_name": "mdanielwork/intellij-community", "path": "plugins/git4idea/src/git4idea/fetch/GitFetchSupport.java", "license": "apache-2.0", "size": 1985 }
[ "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
776,530
public String deleteSpaceProfileInst(String sSpaceProfileId, String userId) { SilverTrace.info("admin", "AdminController.deleteSpaceProfileInst", "root.MSG_GEN_ENTER_METHOD"); try { return getAdminService().deleteSpaceProfileInst(sSpaceProfileId, userId); } catch (Exception e) { SilverTrace.error("admin", "AdminController.deleteSpaceProfileInst", "admin.MSG_ERR_DELETE_SPACE_PROFILE", e); return ""; } }
String function(String sSpaceProfileId, String userId) { SilverTrace.info("admin", STR, STR); try { return getAdminService().deleteSpaceProfileInst(sSpaceProfileId, userId); } catch (Exception e) { SilverTrace.error("admin", STR, STR, e); return ""; } }
/** * Delete the Space Profile Instance corresponding to the given Space Profile id */
Delete the Space Profile Instance corresponding to the given Space Profile id
deleteSpaceProfileInst
{ "repo_name": "NicolasEYSSERIC/Silverpeas-Core", "path": "lib-core/src/main/java/com/stratelia/webactiv/beans/admin/AdminController.java", "license": "agpl-3.0", "size": 59799 }
[ "com.stratelia.silverpeas.silvertrace.SilverTrace", "com.stratelia.webactiv.beans.admin.AdminReference" ]
import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.beans.admin.AdminReference;
import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.beans.admin.*;
[ "com.stratelia.silverpeas", "com.stratelia.webactiv" ]
com.stratelia.silverpeas; com.stratelia.webactiv;
2,577,524
byte[] rebuildRootStore() { while( (directoryVector.size() % 4) != 0 ) { // add "null" storages to ensure multiples of 4 (128*4=512==minimum size) createStorage( "", 0, -1 ); } Enumeration e = directoryVector.elements(); byte[] bytebuff = new byte[directoryVector.size() * DIRECTORY_SIZE]; int pos = 0; while( e.hasMoreElements() ) { Storage s = (Storage) e.nextElement(); ByteBuffer buff = getDirectoryHeaderBytes( s ); System.arraycopy( buff.array(), 0, bytebuff, pos, DIRECTORY_SIZE ); pos += DIRECTORY_SIZE; } return bytebuff; }
byte[] rebuildRootStore() { while( (directoryVector.size() % 4) != 0 ) { createStorage( "", 0, -1 ); } Enumeration e = directoryVector.elements(); byte[] bytebuff = new byte[directoryVector.size() * DIRECTORY_SIZE]; int pos = 0; while( e.hasMoreElements() ) { Storage s = (Storage) e.nextElement(); ByteBuffer buff = getDirectoryHeaderBytes( s ); System.arraycopy( buff.array(), 0, bytebuff, pos, DIRECTORY_SIZE ); pos += DIRECTORY_SIZE; } return bytebuff; }
/** * generate new RootStorage bytes from * all of the Storage directories */
generate new RootStorage bytes from all of the Storage directories
rebuildRootStore
{ "repo_name": "Maxels88/openxls", "path": "src/main/java/org/openxls/formats/LEO/StorageTable.java", "license": "gpl-3.0", "size": 20752 }
[ "java.nio.ByteBuffer", "java.util.Enumeration" ]
import java.nio.ByteBuffer; import java.util.Enumeration;
import java.nio.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
1,013,670
public void setEmbeddableList2( List<Embeddable1> list ) { this.embeddableList2 = list; }
void function( List<Embeddable1> list ) { this.embeddableList2 = list; }
/** * Accessor method. * * @param list the homeAddresses to set */
Accessor method
setEmbeddableList2
{ "repo_name": "ermanno-pirotta/playground", "path": "hibernate.composition/src/main/java/com/piro84/model1/Entity1.java", "license": "lgpl-3.0", "size": 7140 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
437,434
protected static Set getDeltaCRLs(Date currentDate, ExtendedPKIXParameters paramsPKIX, X509CRL completeCRL) throws AnnotatedException { X509CRLStoreSelector deltaSelect = new X509CRLStoreSelector(); // 5.2.4 (a) try { deltaSelect.addIssuerName(CertPathValidatorUtilities .getIssuerPrincipal(completeCRL).getEncoded()); } catch (IOException e) { throw new AnnotatedException("Cannot extract issuer from CRL.", e); } BigInteger completeCRLNumber = null; try { ASN1Primitive derObject = CertPathValidatorUtilities.getExtensionValue(completeCRL, CRL_NUMBER); if (derObject != null) { completeCRLNumber = ASN1Integer.getInstance(derObject).getPositiveValue(); } } catch (Exception e) { throw new AnnotatedException( "CRL number extension could not be extracted from CRL.", e); } // 5.2.4 (b) byte[] idp = null; try { idp = completeCRL.getExtensionValue(ISSUING_DISTRIBUTION_POINT); } catch (Exception e) { throw new AnnotatedException( "Issuing distribution point extension value could not be read.", e); } // 5.2.4 (d) deltaSelect.setMinCRLNumber(completeCRLNumber == null ? null : completeCRLNumber .add(BigInteger.valueOf(1))); deltaSelect.setIssuingDistributionPoint(idp); deltaSelect.setIssuingDistributionPointEnabled(true); // 5.2.4 (c) deltaSelect.setMaxBaseCRLNumber(completeCRLNumber); // find delta CRLs Set temp = CRL_UTIL.findCRLs(deltaSelect, paramsPKIX, currentDate); Set result = new HashSet(); for (Iterator it = temp.iterator(); it.hasNext(); ) { X509CRL crl = (X509CRL)it.next(); if (isDeltaCRL(crl)) { result.add(crl); } } return result; }
static Set function(Date currentDate, ExtendedPKIXParameters paramsPKIX, X509CRL completeCRL) throws AnnotatedException { X509CRLStoreSelector deltaSelect = new X509CRLStoreSelector(); try { deltaSelect.addIssuerName(CertPathValidatorUtilities .getIssuerPrincipal(completeCRL).getEncoded()); } catch (IOException e) { throw new AnnotatedException(STR, e); } BigInteger completeCRLNumber = null; try { ASN1Primitive derObject = CertPathValidatorUtilities.getExtensionValue(completeCRL, CRL_NUMBER); if (derObject != null) { completeCRLNumber = ASN1Integer.getInstance(derObject).getPositiveValue(); } } catch (Exception e) { throw new AnnotatedException( STR, e); } byte[] idp = null; try { idp = completeCRL.getExtensionValue(ISSUING_DISTRIBUTION_POINT); } catch (Exception e) { throw new AnnotatedException( STR, e); } deltaSelect.setMinCRLNumber(completeCRLNumber == null ? null : completeCRLNumber .add(BigInteger.valueOf(1))); deltaSelect.setIssuingDistributionPoint(idp); deltaSelect.setIssuingDistributionPointEnabled(true); deltaSelect.setMaxBaseCRLNumber(completeCRLNumber); Set temp = CRL_UTIL.findCRLs(deltaSelect, paramsPKIX, currentDate); Set result = new HashSet(); for (Iterator it = temp.iterator(); it.hasNext(); ) { X509CRL crl = (X509CRL)it.next(); if (isDeltaCRL(crl)) { result.add(crl); } } return result; }
/** * Fetches delta CRLs according to RFC 3280 section 5.2.4. * * @param currentDate The date for which the delta CRLs must be valid. * @param paramsPKIX The extended PKIX parameters. * @param completeCRL The complete CRL the delta CRL is for. * @return A <code>Set</code> of <code>X509CRL</code>s with delta CRLs. * @throws AnnotatedException if an exception occurs while picking the delta * CRLs. */
Fetches delta CRLs according to RFC 3280 section 5.2.4
getDeltaCRLs
{ "repo_name": "GaloisInc/hacrypto", "path": "src/Java/BouncyCastle/BouncyCastle-1.50/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java", "license": "bsd-3-clause", "size": 48705 }
[ "java.io.IOException", "java.math.BigInteger", "java.util.Date", "java.util.HashSet", "java.util.Iterator", "java.util.Set", "org.bouncycastle.asn1.ASN1Integer", "org.bouncycastle.asn1.ASN1Primitive", "org.bouncycastle.x509.ExtendedPKIXParameters", "org.bouncycastle.x509.X509CRLStoreSelector" ]
import java.io.IOException; import java.math.BigInteger; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.x509.ExtendedPKIXParameters; import org.bouncycastle.x509.X509CRLStoreSelector;
import java.io.*; import java.math.*; import java.util.*; import org.bouncycastle.asn1.*; import org.bouncycastle.x509.*;
[ "java.io", "java.math", "java.util", "org.bouncycastle.asn1", "org.bouncycastle.x509" ]
java.io; java.math; java.util; org.bouncycastle.asn1; org.bouncycastle.x509;
1,712,406
PartyTradeIdentifier.builder().tradeId(TRADE_ID).build(); }
PartyTradeIdentifier.builder().tradeId(TRADE_ID).build(); }
/** * Tests that the counterparty must be set. */
Tests that the counterparty must be set
testCounterpartyNotNull
{ "repo_name": "McLeodMoores/starling", "path": "projects/starling-client/src/test/java/com/mcleodmoores/starling/client/fpml5_8/PartyTradeIdentifierTest.java", "license": "apache-2.0", "size": 2081 }
[ "com.mcleodmoores.starling.client.portfolio.fpml5_8.PartyTradeIdentifier" ]
import com.mcleodmoores.starling.client.portfolio.fpml5_8.PartyTradeIdentifier;
import com.mcleodmoores.starling.client.portfolio.fpml5_8.*;
[ "com.mcleodmoores.starling" ]
com.mcleodmoores.starling;
1,976,690
public void setParams(Map<String, Object> params) { this.params = params; }
void function(Map<String, Object> params) { this.params = params; }
/** * Sets the params. * @param params the params to set */
Sets the params
setParams
{ "repo_name": "christophd/citrus", "path": "endpoints/citrus-http/src/main/java/com/consol/citrus/http/client/BasicAuthClientHttpRequestFactory.java", "license": "apache-2.0", "size": 5458 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
958,684
public void log() { for (String subsystemName: MidpointAspect.SUBSYSTEMS) { logAllLevels(LOGGER, subsystemName); } logAllLevels(LOGGER, null); }
void function() { for (String subsystemName: MidpointAspect.SUBSYSTEMS) { logAllLevels(LOGGER, subsystemName); } logAllLevels(LOGGER, null); }
/** * Log all levels in all subsystems. */
Log all levels in all subsystems
log
{ "repo_name": "sabriarabacioglu/engerek", "path": "model/model-test/src/main/java/com/evolveum/midpoint/model/test/LogfileTestTailer.java", "license": "apache-2.0", "size": 7641 }
[ "com.evolveum.midpoint.util.aspect.MidpointAspect" ]
import com.evolveum.midpoint.util.aspect.MidpointAspect;
import com.evolveum.midpoint.util.aspect.*;
[ "com.evolveum.midpoint" ]
com.evolveum.midpoint;
2,466,694
public void createJobAuditTrail(String oldJobStatus, VEGLJob curJob, Exception exception) { String message = ExceptionUtils.getStackTrace(exception); if(message.length() > 1000){ message = message.substring(0,1000); } VGLJobAuditLog vglJobAuditLog = null; try { vglJobAuditLog = new VGLJobAuditLog(); vglJobAuditLog.setJobId(curJob.getId()); vglJobAuditLog.setFromStatus(oldJobStatus); vglJobAuditLog.setToStatus(curJob.getStatus()); vglJobAuditLog.setTransitionDate(new Date()); vglJobAuditLog.setMessage(message); // Failure in the creation of the job life cycle audit trail is // not critical hence we allow it to fail silently and log it. vglJobAuditLogDao.save(vglJobAuditLog); } catch (Exception ex) { logger.warn("Error creating audit trail for job: " + vglJobAuditLog, ex); } }
void function(String oldJobStatus, VEGLJob curJob, Exception exception) { String message = ExceptionUtils.getStackTrace(exception); if(message.length() > 1000){ message = message.substring(0,1000); } VGLJobAuditLog vglJobAuditLog = null; try { vglJobAuditLog = new VGLJobAuditLog(); vglJobAuditLog.setJobId(curJob.getId()); vglJobAuditLog.setFromStatus(oldJobStatus); vglJobAuditLog.setToStatus(curJob.getStatus()); vglJobAuditLog.setTransitionDate(new Date()); vglJobAuditLog.setMessage(message); vglJobAuditLogDao.save(vglJobAuditLog); } catch (Exception ex) { logger.warn(STR + vglJobAuditLog, ex); } }
/** * Create the job life cycle audit trail. If the creation is unsuccessful, it * will silently fail and log the failure message to error log. * @param oldJobStatus * @param curJob * @param message */
Create the job life cycle audit trail. If the creation is unsuccessful, it will silently fail and log the failure message to error log
createJobAuditTrail
{ "repo_name": "AuScope/VEGL-Portal", "path": "src/main/java/org/auscope/portal/server/vegl/VEGLJobManager.java", "license": "gpl-3.0", "size": 4770 }
[ "java.util.Date", "org.apache.commons.lang.exception.ExceptionUtils" ]
import java.util.Date; import org.apache.commons.lang.exception.ExceptionUtils;
import java.util.*; import org.apache.commons.lang.exception.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,766,777
public void init(FilterConfig filterConfig) { }
void function(FilterConfig filterConfig) { }
/** * The init method. * @param filterConfig parameters. */
The init method
init
{ "repo_name": "OleksandrProshak/Alexandr_Proshak", "path": "Level_Junior/Part_004_Servlet_JSP/7_Mockito/src/main/java/ru/job4j/task1/controller/filters/EditFilter.java", "license": "apache-2.0", "size": 2761 }
[ "javax.servlet.FilterConfig" ]
import javax.servlet.FilterConfig;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,337,945
@DELETE @Path("{definitionId}/{revision}") public Response deleteDefinition(@PathParam("definitionId") String definitionId, @PathParam("revision") Long revision) { if (revision == null) { return RestUtil.buildErrorResponse(Status.BAD_REQUEST, "Revision number should be specified."); } DeletedDefinitionInfo definitionInfo = mutableDefinitionService.deleteDefinition(GenericDefinition.class, definitionId, revision); return RestUtil .buildDataResponse(Collections.singletonList(typeConverter.convert(JSONObject.class, definitionInfo))); }
@Path(STR) Response function(@PathParam(STR) String definitionId, @PathParam(STR) Long revision) { if (revision == null) { return RestUtil.buildErrorResponse(Status.BAD_REQUEST, STR); } DeletedDefinitionInfo definitionInfo = mutableDefinitionService.deleteDefinition(GenericDefinition.class, definitionId, revision); return RestUtil .buildDataResponse(Collections.singletonList(typeConverter.convert(JSONObject.class, definitionInfo))); }
/** * Delete definition. * * @param definitionId * the definition id * @param revision * the revision * @return the response */
Delete definition
deleteDefinition
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/model-management/definition-core/src/main/java/com/sirma/itt/seip/definition/rest/DefinitionRestService.java", "license": "lgpl-3.0", "size": 8866 }
[ "com.sirma.itt.seip.definition.DeletedDefinitionInfo", "com.sirma.itt.seip.domain.definition.GenericDefinition", "com.sirma.itt.seip.rest.RestUtil", "java.util.Collections", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.core.Response", "org.json.JSONObject" ]
import com.sirma.itt.seip.definition.DeletedDefinitionInfo; import com.sirma.itt.seip.domain.definition.GenericDefinition; import com.sirma.itt.seip.rest.RestUtil; import java.util.Collections; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import org.json.JSONObject;
import com.sirma.itt.seip.definition.*; import com.sirma.itt.seip.domain.definition.*; import com.sirma.itt.seip.rest.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.json.*;
[ "com.sirma.itt", "java.util", "javax.ws", "org.json" ]
com.sirma.itt; java.util; javax.ws; org.json;
1,479,479
public void open() throws IOException { checkOpened(); }
void function() throws IOException { checkOpened(); }
/** * Optional call to open the underlying {@link DataSource}. * <p> * Calling this method does nothing if the {@link DataSource} is already open. Calling this * method is optional, since the read and skip methods will automatically open the underlying * {@link DataSource} if it's not open already. * * @throws IOException If an error occurs opening the {@link DataSource}. */
Optional call to open the underlying <code>DataSource</code>. Calling this method does nothing if the <code>DataSource</code> is already open. Calling this method is optional, since the read and skip methods will automatically open the underlying <code>DataSource</code> if it's not open already
open
{ "repo_name": "profosure/porogram", "path": "TMessagesProj/src/main/java/com/porogram/profosure1/messenger/exoplayer2/upstream/DataSourceInputStream.java", "license": "gpl-2.0", "size": 3550 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,462,613
@ApiModelProperty(value = "") public ErrorDetails getErrorDetails() { return errorDetails; }
@ApiModelProperty(value = "") ErrorDetails function() { return errorDetails; }
/** * Get errorDetails. * @return errorDetails **/
Get errorDetails
getErrorDetails
{ "repo_name": "docusign/docusign-java-client", "path": "src/main/java/com/docusign/esign/model/Folder.java", "license": "mit", "size": 11900 }
[ "com.docusign.esign.model.ErrorDetails", "io.swagger.annotations.ApiModelProperty" ]
import com.docusign.esign.model.ErrorDetails; import io.swagger.annotations.ApiModelProperty;
import com.docusign.esign.model.*; import io.swagger.annotations.*;
[ "com.docusign.esign", "io.swagger.annotations" ]
com.docusign.esign; io.swagger.annotations;
261,238