idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
31,500 | public List < CPDefinitionSpecificationOptionValue > getCPDefinitionSpecificationOptionValuesByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CPDefinitionSpecificationOptionValue > orderByComparator ) { return cpDefinitionSpecificationOptionValuePersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; } | Returns a range of cp definition specification option values matching the UUID and company . |
31,501 | @ Indexable ( type = IndexableType . REINDEX ) public CPDefinitionSpecificationOptionValue updateCPDefinitionSpecificationOptionValue ( CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue ) { return cpDefinitionSpecificationOptionValuePersistence . update ( cpDefinitionSpecificationOptionValue ) ; } | Updates the cp definition specification option value in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners . |
31,502 | public com . liferay . commerce . tax . engine . fixed . model . CommerceTaxFixedRate getCommerceTaxFixedRate ( long commerceTaxFixedRateId ) throws com . liferay . portal . kernel . exception . PortalException { return _commerceTaxFixedRateLocalService . getCommerceTaxFixedRate ( commerceTaxFixedRateId ) ; } | Returns the commerce tax fixed rate with the primary key . |
31,503 | public void cacheResult ( CommerceWarehouse commerceWarehouse ) { entityCache . putResult ( CommerceWarehouseModelImpl . ENTITY_CACHE_ENABLED , CommerceWarehouseImpl . class , commerceWarehouse . getPrimaryKey ( ) , commerceWarehouse ) ; commerceWarehouse . resetOriginalValues ( ) ; } | Caches the commerce warehouse in the entity cache if it is enabled . |
31,504 | public void cacheResult ( List < CommerceWarehouse > commerceWarehouses ) { for ( CommerceWarehouse commerceWarehouse : commerceWarehouses ) { if ( entityCache . getResult ( CommerceWarehouseModelImpl . ENTITY_CACHE_ENABLED , CommerceWarehouseImpl . class , commerceWarehouse . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceWarehouse ) ; } else { commerceWarehouse . resetOriginalValues ( ) ; } } } | Caches the commerce warehouses in the entity cache if it is enabled . |
31,505 | public void clearCache ( ) { entityCache . clearCache ( CommerceWarehouseImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all commerce warehouses . |
31,506 | public void clearCache ( CommerceWarehouse commerceWarehouse ) { entityCache . removeResult ( CommerceWarehouseModelImpl . ENTITY_CACHE_ENABLED , CommerceWarehouseImpl . class , commerceWarehouse . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for the commerce warehouse . |
31,507 | public List < CommerceWarehouse > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the commerce warehouses . |
31,508 | @ Indexable ( type = IndexableType . REINDEX ) public CPFriendlyURLEntry addCPFriendlyURLEntry ( CPFriendlyURLEntry cpFriendlyURLEntry ) { cpFriendlyURLEntry . setNew ( true ) ; return cpFriendlyURLEntryPersistence . update ( cpFriendlyURLEntry ) ; } | Adds the cp friendly url entry to the database . Also notifies the appropriate model listeners . |
31,509 | @ Indexable ( type = IndexableType . DELETE ) public CPFriendlyURLEntry deleteCPFriendlyURLEntry ( long CPFriendlyURLEntryId ) throws PortalException { return cpFriendlyURLEntryPersistence . remove ( CPFriendlyURLEntryId ) ; } | Deletes the cp friendly url entry with the primary key from the database . Also notifies the appropriate model listeners . |
31,510 | @ Indexable ( type = IndexableType . DELETE ) public CPFriendlyURLEntry deleteCPFriendlyURLEntry ( CPFriendlyURLEntry cpFriendlyURLEntry ) { return cpFriendlyURLEntryPersistence . remove ( cpFriendlyURLEntry ) ; } | Deletes the cp friendly url entry from the database . Also notifies the appropriate model listeners . |
31,511 | public List < CPFriendlyURLEntry > getCPFriendlyURLEntriesByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CPFriendlyURLEntry > orderByComparator ) { return cpFriendlyURLEntryPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; } | Returns a range of cp friendly url entries matching the UUID and company . |
31,512 | public CommerceOrderItem fetchCommerceOrderItemByReferenceCode ( long companyId , String externalReferenceCode ) { return commerceOrderItemPersistence . fetchByC_ERC ( companyId , null ) ; } | Returns the commerce order item with the matching external reference code and company . |
31,513 | public String getTitle ( String languageId , boolean useDefault ) { return _commerceAvailabilityEstimate . getTitle ( languageId , useDefault ) ; } | Returns the localized title of this commerce availability estimate in the language optionally using the default language if no localization exists for the requested language . |
31,514 | @ Indexable ( type = IndexableType . REINDEX ) public CPSpecificationOption addCPSpecificationOption ( CPSpecificationOption cpSpecificationOption ) { cpSpecificationOption . setNew ( true ) ; return cpSpecificationOptionPersistence . update ( cpSpecificationOption ) ; } | Adds the cp specification option to the database . Also notifies the appropriate model listeners . |
31,515 | @ Indexable ( type = IndexableType . DELETE ) public CPSpecificationOption deleteCPSpecificationOption ( long CPSpecificationOptionId ) throws PortalException { return cpSpecificationOptionPersistence . remove ( CPSpecificationOptionId ) ; } | Deletes the cp specification option with the primary key from the database . Also notifies the appropriate model listeners . |
31,516 | public List < CPSpecificationOption > getCPSpecificationOptionsByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CPSpecificationOption > orderByComparator ) { return cpSpecificationOptionPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; } | Returns a range of cp specification options matching the UUID and company . |
31,517 | public void cacheResult ( CPDefinitionVirtualSetting cpDefinitionVirtualSetting ) { entityCache . putResult ( CPDefinitionVirtualSettingModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionVirtualSettingImpl . class , cpDefinitionVirtualSetting . getPrimaryKey ( ) , cpDefinitionVirtualSetting ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { cpDefinitionVirtualSetting . getUuid ( ) , cpDefinitionVirtualSetting . getGroupId ( ) } , cpDefinitionVirtualSetting ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C , new Object [ ] { cpDefinitionVirtualSetting . getClassNameId ( ) , cpDefinitionVirtualSetting . getClassPK ( ) } , cpDefinitionVirtualSetting ) ; cpDefinitionVirtualSetting . resetOriginalValues ( ) ; } | Caches the cp definition virtual setting in the entity cache if it is enabled . |
31,518 | public void cacheResult ( List < CPDefinitionVirtualSetting > cpDefinitionVirtualSettings ) { for ( CPDefinitionVirtualSetting cpDefinitionVirtualSetting : cpDefinitionVirtualSettings ) { if ( entityCache . getResult ( CPDefinitionVirtualSettingModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionVirtualSettingImpl . class , cpDefinitionVirtualSetting . getPrimaryKey ( ) ) == null ) { cacheResult ( cpDefinitionVirtualSetting ) ; } else { cpDefinitionVirtualSetting . resetOriginalValues ( ) ; } } } | Caches the cp definition virtual settings in the entity cache if it is enabled . |
31,519 | public void clearCache ( ) { entityCache . clearCache ( CPDefinitionVirtualSettingImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all cp definition virtual settings . |
31,520 | public void clearCache ( CPDefinitionVirtualSetting cpDefinitionVirtualSetting ) { entityCache . removeResult ( CPDefinitionVirtualSettingModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionVirtualSettingImpl . class , cpDefinitionVirtualSetting . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CPDefinitionVirtualSettingModelImpl ) cpDefinitionVirtualSetting , true ) ; } | Clears the cache for the cp definition virtual setting . |
31,521 | public CPDefinitionVirtualSetting remove ( Serializable primaryKey ) throws NoSuchCPDefinitionVirtualSettingException { Session session = null ; try { session = openSession ( ) ; CPDefinitionVirtualSetting cpDefinitionVirtualSetting = ( CPDefinitionVirtualSetting ) session . get ( CPDefinitionVirtualSettingImpl . class , primaryKey ) ; if ( cpDefinitionVirtualSetting == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchCPDefinitionVirtualSettingException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return remove ( cpDefinitionVirtualSetting ) ; } catch ( NoSuchCPDefinitionVirtualSettingException nsee ) { throw nsee ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } } | Removes the cp definition virtual setting with the primary key from the database . Also notifies the appropriate model listeners . |
31,522 | public List < CPDefinitionVirtualSetting > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the cp definition virtual settings . |
31,523 | public void cacheResult ( CommerceNotificationAttachment commerceNotificationAttachment ) { entityCache . putResult ( CommerceNotificationAttachmentModelImpl . ENTITY_CACHE_ENABLED , CommerceNotificationAttachmentImpl . class , commerceNotificationAttachment . getPrimaryKey ( ) , commerceNotificationAttachment ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { commerceNotificationAttachment . getUuid ( ) , commerceNotificationAttachment . getGroupId ( ) } , commerceNotificationAttachment ) ; commerceNotificationAttachment . resetOriginalValues ( ) ; } | Caches the commerce notification attachment in the entity cache if it is enabled . |
31,524 | public void cacheResult ( List < CommerceNotificationAttachment > commerceNotificationAttachments ) { for ( CommerceNotificationAttachment commerceNotificationAttachment : commerceNotificationAttachments ) { if ( entityCache . getResult ( CommerceNotificationAttachmentModelImpl . ENTITY_CACHE_ENABLED , CommerceNotificationAttachmentImpl . class , commerceNotificationAttachment . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceNotificationAttachment ) ; } else { commerceNotificationAttachment . resetOriginalValues ( ) ; } } } | Caches the commerce notification attachments in the entity cache if it is enabled . |
31,525 | public void clearCache ( ) { entityCache . clearCache ( CommerceNotificationAttachmentImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all commerce notification attachments . |
31,526 | public void clearCache ( CommerceNotificationAttachment commerceNotificationAttachment ) { entityCache . removeResult ( CommerceNotificationAttachmentModelImpl . ENTITY_CACHE_ENABLED , CommerceNotificationAttachmentImpl . class , commerceNotificationAttachment . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CommerceNotificationAttachmentModelImpl ) commerceNotificationAttachment , true ) ; } | Clears the cache for the commerce notification attachment . |
31,527 | public List < CommerceNotificationAttachment > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the commerce notification attachments . |
31,528 | public void cacheResult ( CommerceDiscountUsageEntry commerceDiscountUsageEntry ) { entityCache . putResult ( CommerceDiscountUsageEntryModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountUsageEntryImpl . class , commerceDiscountUsageEntry . getPrimaryKey ( ) , commerceDiscountUsageEntry ) ; commerceDiscountUsageEntry . resetOriginalValues ( ) ; } | Caches the commerce discount usage entry in the entity cache if it is enabled . |
31,529 | public void cacheResult ( List < CommerceDiscountUsageEntry > commerceDiscountUsageEntries ) { for ( CommerceDiscountUsageEntry commerceDiscountUsageEntry : commerceDiscountUsageEntries ) { if ( entityCache . getResult ( CommerceDiscountUsageEntryModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountUsageEntryImpl . class , commerceDiscountUsageEntry . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceDiscountUsageEntry ) ; } else { commerceDiscountUsageEntry . resetOriginalValues ( ) ; } } } | Caches the commerce discount usage entries in the entity cache if it is enabled . |
31,530 | public void clearCache ( ) { entityCache . clearCache ( CommerceDiscountUsageEntryImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all commerce discount usage entries . |
31,531 | public void clearCache ( CommerceDiscountUsageEntry commerceDiscountUsageEntry ) { entityCache . removeResult ( CommerceDiscountUsageEntryModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountUsageEntryImpl . class , commerceDiscountUsageEntry . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for the commerce discount usage entry . |
31,532 | public CommerceDiscountUsageEntry remove ( Serializable primaryKey ) throws NoSuchDiscountUsageEntryException { Session session = null ; try { session = openSession ( ) ; CommerceDiscountUsageEntry commerceDiscountUsageEntry = ( CommerceDiscountUsageEntry ) session . get ( CommerceDiscountUsageEntryImpl . class , primaryKey ) ; if ( commerceDiscountUsageEntry == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchDiscountUsageEntryException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return remove ( commerceDiscountUsageEntry ) ; } catch ( NoSuchDiscountUsageEntryException nsee ) { throw nsee ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } } | Removes the commerce discount usage entry with the primary key from the database . Also notifies the appropriate model listeners . |
31,533 | public List < CommerceDiscountUsageEntry > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the commerce discount usage entries . |
31,534 | public void cacheResult ( CPDefinitionOptionRel cpDefinitionOptionRel ) { entityCache . putResult ( CPDefinitionOptionRelModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionOptionRelImpl . class , cpDefinitionOptionRel . getPrimaryKey ( ) , cpDefinitionOptionRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { cpDefinitionOptionRel . getUuid ( ) , cpDefinitionOptionRel . getGroupId ( ) } , cpDefinitionOptionRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C , new Object [ ] { cpDefinitionOptionRel . getCPDefinitionId ( ) , cpDefinitionOptionRel . getCPOptionId ( ) } , cpDefinitionOptionRel ) ; cpDefinitionOptionRel . resetOriginalValues ( ) ; } | Caches the cp definition option rel in the entity cache if it is enabled . |
31,535 | public void cacheResult ( List < CPDefinitionOptionRel > cpDefinitionOptionRels ) { for ( CPDefinitionOptionRel cpDefinitionOptionRel : cpDefinitionOptionRels ) { if ( entityCache . getResult ( CPDefinitionOptionRelModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionOptionRelImpl . class , cpDefinitionOptionRel . getPrimaryKey ( ) ) == null ) { cacheResult ( cpDefinitionOptionRel ) ; } else { cpDefinitionOptionRel . resetOriginalValues ( ) ; } } } | Caches the cp definition option rels in the entity cache if it is enabled . |
31,536 | public void clearCache ( ) { entityCache . clearCache ( CPDefinitionOptionRelImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all cp definition option rels . |
31,537 | public void clearCache ( CPDefinitionOptionRel cpDefinitionOptionRel ) { entityCache . removeResult ( CPDefinitionOptionRelModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionOptionRelImpl . class , cpDefinitionOptionRel . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CPDefinitionOptionRelModelImpl ) cpDefinitionOptionRel , true ) ; } | Clears the cache for the cp definition option rel . |
31,538 | public List < CPDefinitionOptionRel > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the cp definition option rels . |
31,539 | public void setCommerceWishListItemService ( com . liferay . commerce . wish . list . service . CommerceWishListItemService commerceWishListItemService ) { this . commerceWishListItemService = commerceWishListItemService ; } | Sets the commerce wish list item remote service . |
31,540 | public CommerceTierPriceEntry fetchCommerceTierPriceEntryByReferenceCode ( long companyId , String externalReferenceCode ) { return commerceTierPriceEntryPersistence . fetchByC_ERC ( companyId , null ) ; } | Returns the commerce tier price entry with the matching external reference code and company . |
31,541 | public List < CommerceTierPriceEntry > getCommerceTierPriceEntriesByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CommerceTierPriceEntry > orderByComparator ) { return commerceTierPriceEntryPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; } | Returns a range of commerce tier price entries matching the UUID and company . |
31,542 | public void cacheResult ( CommerceDiscountRule commerceDiscountRule ) { entityCache . putResult ( CommerceDiscountRuleModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountRuleImpl . class , commerceDiscountRule . getPrimaryKey ( ) , commerceDiscountRule ) ; commerceDiscountRule . resetOriginalValues ( ) ; } | Caches the commerce discount rule in the entity cache if it is enabled . |
31,543 | public void cacheResult ( List < CommerceDiscountRule > commerceDiscountRules ) { for ( CommerceDiscountRule commerceDiscountRule : commerceDiscountRules ) { if ( entityCache . getResult ( CommerceDiscountRuleModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountRuleImpl . class , commerceDiscountRule . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceDiscountRule ) ; } else { commerceDiscountRule . resetOriginalValues ( ) ; } } } | Caches the commerce discount rules in the entity cache if it is enabled . |
31,544 | public void clearCache ( ) { entityCache . clearCache ( CommerceDiscountRuleImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all commerce discount rules . |
31,545 | public void clearCache ( CommerceDiscountRule commerceDiscountRule ) { entityCache . removeResult ( CommerceDiscountRuleModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountRuleImpl . class , commerceDiscountRule . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for the commerce discount rule . |
31,546 | public CommerceDiscountRule remove ( Serializable primaryKey ) throws NoSuchDiscountRuleException { Session session = null ; try { session = openSession ( ) ; CommerceDiscountRule commerceDiscountRule = ( CommerceDiscountRule ) session . get ( CommerceDiscountRuleImpl . class , primaryKey ) ; if ( commerceDiscountRule == null ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } throw new NoSuchDiscountRuleException ( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey ) ; } return remove ( commerceDiscountRule ) ; } catch ( NoSuchDiscountRuleException nsee ) { throw nsee ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } } | Removes the commerce discount rule with the primary key from the database . Also notifies the appropriate model listeners . |
31,547 | public List < CommerceDiscountRule > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the commerce discount rules . |
31,548 | public void setCommerceNotificationQueueEntryService ( com . liferay . commerce . notification . service . CommerceNotificationQueueEntryService commerceNotificationQueueEntryService ) { this . commerceNotificationQueueEntryService = commerceNotificationQueueEntryService ; } | Sets the commerce notification queue entry remote service . |
31,549 | public com . liferay . commerce . product . model . CPDefinitionSpecificationOptionValue getCPDefinitionSpecificationOptionValue ( long CPDefinitionSpecificationOptionValueId ) throws com . liferay . portal . kernel . exception . PortalException { return _cpDefinitionSpecificationOptionValueLocalService . getCPDefinitionSpecificationOptionValue ( CPDefinitionSpecificationOptionValueId ) ; } | Returns the cp definition specification option value with the primary key . |
31,550 | @ Indexable ( type = IndexableType . DELETE ) public CommerceWishListItem deleteCommerceWishListItem ( long commerceWishListItemId ) throws PortalException { return commerceWishListItemPersistence . remove ( commerceWishListItemId ) ; } | Deletes the commerce wish list item with the primary key from the database . Also notifies the appropriate model listeners . |
31,551 | @ Indexable ( type = IndexableType . DELETE ) public CommerceWishListItem deleteCommerceWishListItem ( CommerceWishListItem commerceWishListItem ) { return commerceWishListItemPersistence . remove ( commerceWishListItem ) ; } | Deletes the commerce wish list item from the database . Also notifies the appropriate model listeners . |
31,552 | public static com . liferay . commerce . product . model . CPInstance getCPInstance ( long CPInstanceId ) throws com . liferay . portal . kernel . exception . PortalException { return getService ( ) . getCPInstance ( CPInstanceId ) ; } | Returns the cp instance with the primary key . |
31,553 | @ Indexable ( type = IndexableType . DELETE ) public CommerceWarehouse deleteCommerceWarehouse ( long commerceWarehouseId ) throws PortalException { return commerceWarehousePersistence . remove ( commerceWarehouseId ) ; } | Deletes the commerce warehouse with the primary key from the database . Also notifies the appropriate model listeners . |
31,554 | protected void runSQL ( String sql ) { try { DataSource dataSource = commerceWarehousePersistence . getDataSource ( ) ; DB db = DBManagerUtil . getDB ( ) ; sql = db . buildSQL ( sql ) ; sql = PortalUtil . transformSQL ( sql ) ; SqlUpdate sqlUpdate = SqlUpdateFactoryUtil . getSqlUpdate ( dataSource , sql ) ; sqlUpdate . update ( ) ; } catch ( Exception e ) { throw new SystemException ( e ) ; } } | Performs a SQL query . |
31,555 | public void cacheResult ( CPDefinitionOptionValueRel cpDefinitionOptionValueRel ) { entityCache . putResult ( CPDefinitionOptionValueRelModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionOptionValueRelImpl . class , cpDefinitionOptionValueRel . getPrimaryKey ( ) , cpDefinitionOptionValueRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { cpDefinitionOptionValueRel . getUuid ( ) , cpDefinitionOptionValueRel . getGroupId ( ) } , cpDefinitionOptionValueRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_K , new Object [ ] { cpDefinitionOptionValueRel . getCPDefinitionOptionRelId ( ) , cpDefinitionOptionValueRel . getKey ( ) } , cpDefinitionOptionValueRel ) ; cpDefinitionOptionValueRel . resetOriginalValues ( ) ; } | Caches the cp definition option value rel in the entity cache if it is enabled . |
31,556 | public void cacheResult ( List < CPDefinitionOptionValueRel > cpDefinitionOptionValueRels ) { for ( CPDefinitionOptionValueRel cpDefinitionOptionValueRel : cpDefinitionOptionValueRels ) { if ( entityCache . getResult ( CPDefinitionOptionValueRelModelImpl . ENTITY_CACHE_ENABLED , CPDefinitionOptionValueRelImpl . class , cpDefinitionOptionValueRel . getPrimaryKey ( ) ) == null ) { cacheResult ( cpDefinitionOptionValueRel ) ; } else { cpDefinitionOptionValueRel . resetOriginalValues ( ) ; } } } | Caches the cp definition option value rels in the entity cache if it is enabled . |
31,557 | public void clearCache ( ) { entityCache . clearCache ( CPDefinitionOptionValueRelImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all cp definition option value rels . |
31,558 | public List < CPDefinitionOptionValueRel > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the cp definition option value rels . |
31,559 | @ Indexable ( type = IndexableType . DELETE ) public CPDefinitionOptionRel deleteCPDefinitionOptionRel ( long CPDefinitionOptionRelId ) throws PortalException { return cpDefinitionOptionRelPersistence . remove ( CPDefinitionOptionRelId ) ; } | Deletes the cp definition option rel with the primary key from the database . Also notifies the appropriate model listeners . |
31,560 | public List < CPDefinitionOptionRel > getCPDefinitionOptionRelsByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CPDefinitionOptionRel > orderByComparator ) { return cpDefinitionOptionRelPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; } | Returns a range of cp definition option rels matching the UUID and company . |
31,561 | public < T > List < T > dynamicQuery ( DynamicQuery dynamicQuery , int start , int end ) { return commerceShipmentItemPersistence . findWithDynamicQuery ( dynamicQuery , start , end ) ; } | Performs a dynamic query on the database and returns a range of the matching rows . |
31,562 | public void cacheResult ( CommerceDiscount commerceDiscount ) { entityCache . putResult ( CommerceDiscountModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountImpl . class , commerceDiscount . getPrimaryKey ( ) , commerceDiscount ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { commerceDiscount . getUuid ( ) , commerceDiscount . getGroupId ( ) } , commerceDiscount ) ; commerceDiscount . resetOriginalValues ( ) ; } | Caches the commerce discount in the entity cache if it is enabled . |
31,563 | public void cacheResult ( List < CommerceDiscount > commerceDiscounts ) { for ( CommerceDiscount commerceDiscount : commerceDiscounts ) { if ( entityCache . getResult ( CommerceDiscountModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountImpl . class , commerceDiscount . getPrimaryKey ( ) ) == null ) { cacheResult ( commerceDiscount ) ; } else { commerceDiscount . resetOriginalValues ( ) ; } } } | Caches the commerce discounts in the entity cache if it is enabled . |
31,564 | public void clearCache ( ) { entityCache . clearCache ( CommerceDiscountImpl . class ) ; finderCache . clearCache ( FINDER_CLASS_NAME_ENTITY ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; } | Clears the cache for all commerce discounts . |
31,565 | public void clearCache ( CommerceDiscount commerceDiscount ) { entityCache . removeResult ( CommerceDiscountModelImpl . ENTITY_CACHE_ENABLED , CommerceDiscountImpl . class , commerceDiscount . getPrimaryKey ( ) ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITH_PAGINATION ) ; finderCache . clearCache ( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ) ; clearUniqueFindersCache ( ( CommerceDiscountModelImpl ) commerceDiscount , true ) ; } | Clears the cache for the commerce discount . |
31,566 | public List < CommerceDiscount > findAll ( ) { return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; } | Returns all the commerce discounts . |
31,567 | public AuthorizationCodeTokenRequest newTokenRequest ( String authorizationCode ) { return new AuthorizationCodeTokenRequest ( transport , jsonFactory , new GenericUrl ( tokenServerEncodedUrl ) , authorizationCode ) . setClientAuthentication ( clientAuthentication ) . setRequestInitializer ( requestInitializer ) . setScopes ( scopes ) ; } | Returns a new instance of an authorization code token request based on the given authorization code . |
31,568 | @ SuppressWarnings ( "deprecation" ) public Credential createAndStoreCredential ( TokenResponse response , String userId ) throws IOException { Credential credential = newCredential ( userId ) . setFromTokenResponse ( response ) ; if ( credentialStore != null ) { credentialStore . store ( userId , credential ) ; } if ( credentialDataStore != null ) { credentialDataStore . set ( userId , new StoredCredential ( credential ) ) ; } if ( credentialCreatedListener != null ) { credentialCreatedListener . onCredentialCreated ( credential , response ) ; } return credential ; } | Creates a new credential for the given user ID based on the given token response and stores it in the credential store . |
31,569 | @ SuppressWarnings ( "deprecation" ) public Credential loadCredential ( String userId ) throws IOException { if ( isNullOrEmpty ( userId ) ) { return null ; } if ( credentialDataStore == null && credentialStore == null ) { return null ; } Credential credential = newCredential ( userId ) ; if ( credentialDataStore != null ) { StoredCredential stored = credentialDataStore . get ( userId ) ; if ( stored == null ) { return null ; } credential . setAccessToken ( stored . getAccessToken ( ) ) ; credential . setRefreshToken ( stored . getRefreshToken ( ) ) ; credential . setExpirationTimeMilliseconds ( stored . getExpirationTimeMilliseconds ( ) ) ; } else if ( ! credentialStore . load ( userId , credential ) ) { return null ; } return credential ; } | Loads the credential of the given user ID from the credential store . |
31,570 | @ SuppressWarnings ( "deprecation" ) private Credential newCredential ( String userId ) { Credential . Builder builder = new Credential . Builder ( method ) . setTransport ( transport ) . setJsonFactory ( jsonFactory ) . setTokenServerEncodedUrl ( tokenServerEncodedUrl ) . setClientAuthentication ( clientAuthentication ) . setRequestInitializer ( requestInitializer ) . setClock ( clock ) ; if ( credentialDataStore != null ) { builder . addRefreshListener ( new DataStoreCredentialRefreshListener ( userId , credentialDataStore ) ) ; } else if ( credentialStore != null ) { builder . addRefreshListener ( new CredentialStoreRefreshListener ( userId , credentialStore ) ) ; } builder . getRefreshListeners ( ) . addAll ( refreshListeners ) ; return builder . build ( ) ; } | Returns a new credential instance based on the given user ID . |
31,571 | static final String getUserId ( ) { UserService userService = UserServiceFactory . getUserService ( ) ; User loggedIn = userService . getCurrentUser ( ) ; Preconditions . checkState ( loggedIn != null , "This servlet requires the user to be logged in." ) ; return loggedIn . getUserId ( ) ; } | Return the user id for the currently logged in user . |
31,572 | public final OAuthCredentialsResponse execute ( ) throws IOException { HttpRequestFactory requestFactory = transport . createRequestFactory ( ) ; HttpRequest request = requestFactory . buildRequest ( usePost ? HttpMethods . POST : HttpMethods . GET , this , null ) ; createParameters ( ) . intercept ( request ) ; HttpResponse response = request . execute ( ) ; response . setContentLoggingLimit ( 0 ) ; OAuthCredentialsResponse oauthResponse = new OAuthCredentialsResponse ( ) ; UrlEncodedParser . parse ( response . parseAsString ( ) , oauthResponse ) ; return oauthResponse ; } | Executes the HTTP request for a temporary or long - lived token . |
31,573 | public OAuthParameters createParameters ( ) { OAuthParameters result = new OAuthParameters ( ) ; result . consumerKey = consumerKey ; result . signer = signer ; return result ; } | Returns a new instance of the OAuth authentication provider . Subclasses may override by calling this super implementation and then adding OAuth parameters . |
31,574 | public TokenRequest setTokenServerUrl ( GenericUrl tokenServerUrl ) { this . tokenServerUrl = tokenServerUrl ; Preconditions . checkArgument ( tokenServerUrl . getFragment ( ) == null ) ; return this ; } | Sets the token server URL . |
31,575 | public final HttpResponse executeUnparsed ( ) throws IOException { HttpRequestFactory requestFactory = transport . createRequestFactory ( new HttpRequestInitializer ( ) { public void initialize ( HttpRequest request ) throws IOException { if ( requestInitializer != null ) { requestInitializer . initialize ( request ) ; } final HttpExecuteInterceptor interceptor = request . getInterceptor ( ) ; request . setInterceptor ( new HttpExecuteInterceptor ( ) { public void intercept ( HttpRequest request ) throws IOException { if ( interceptor != null ) { interceptor . intercept ( request ) ; } if ( clientAuthentication != null ) { clientAuthentication . intercept ( request ) ; } } } ) ; } } ) ; HttpRequest request = requestFactory . buildPostRequest ( tokenServerUrl , new UrlEncodedContent ( this ) ) ; request . setParser ( new JsonObjectParser ( jsonFactory ) ) ; request . setThrowExceptionOnExecuteError ( false ) ; HttpResponse response = request . execute ( ) ; if ( response . isSuccessStatusCode ( ) ) { return response ; } throw TokenResponseException . from ( jsonFactory , response ) ; } | Executes request for an access token and returns the HTTP response . |
31,576 | public Credential setAccessToken ( String accessToken ) { lock . lock ( ) ; try { this . accessToken = accessToken ; } finally { lock . unlock ( ) ; } return this ; } | Sets the access token . |
31,577 | public Credential setRefreshToken ( String refreshToken ) { lock . lock ( ) ; try { if ( refreshToken != null ) { Preconditions . checkArgument ( jsonFactory != null && transport != null && clientAuthentication != null && tokenServerEncodedUrl != null , "Please use the Builder and call setJsonFactory, setTransport, setClientAuthentication" + " and setTokenServerUrl/setTokenServerEncodedUrl" ) ; } this . refreshToken = refreshToken ; } finally { lock . unlock ( ) ; } return this ; } | Sets the refresh token . |
31,578 | public final boolean refreshToken ( ) throws IOException { lock . lock ( ) ; try { try { TokenResponse tokenResponse = executeRefreshToken ( ) ; if ( tokenResponse != null ) { setFromTokenResponse ( tokenResponse ) ; for ( CredentialRefreshListener refreshListener : refreshListeners ) { refreshListener . onTokenResponse ( this , tokenResponse ) ; } return true ; } } catch ( TokenResponseException e ) { boolean statusCode4xx = 400 <= e . getStatusCode ( ) && e . getStatusCode ( ) < 500 ; if ( e . getDetails ( ) != null && statusCode4xx ) { setAccessToken ( null ) ; setExpiresInSeconds ( null ) ; } for ( CredentialRefreshListener refreshListener : refreshListeners ) { refreshListener . onTokenErrorResponse ( this , e . getDetails ( ) ) ; } if ( statusCode4xx ) { throw e ; } } return false ; } finally { lock . unlock ( ) ; } } | Request a new access token from the authorization endpoint . |
31,579 | protected TokenResponse executeRefreshToken ( ) throws IOException { if ( refreshToken == null ) { return null ; } return new RefreshTokenRequest ( transport , jsonFactory , new GenericUrl ( tokenServerEncodedUrl ) , refreshToken ) . setClientAuthentication ( clientAuthentication ) . setRequestInitializer ( requestInitializer ) . execute ( ) ; } | Executes a request for new credentials from the token server . |
31,580 | private void startAuthFlow ( HttpServletResponse resp , PersistenceManager pm , ThreeLeggedFlow oauthFlow ) throws IOException { pm . makePersistent ( oauthFlow ) ; String authorizationUrl = oauthFlow . getAuthorizationUrl ( ) ; resp . sendRedirect ( authorizationUrl ) ; } | Start the auth flow . Don t run any code after this method that will change the response object . |
31,581 | protected Credential getCredential ( HttpServletRequest req ) { Credential cred = ( Credential ) req . getAttribute ( AUTH_CREDENTIAL ) ; return cred ; } | Fetch a credential associated with this request . |
31,582 | private void ringWrite ( long position , byte [ ] buffer , int offset , int count ) throws IOException { position = wrapPosition ( position ) ; if ( position + count <= fileLength ) { raf . seek ( position ) ; raf . write ( buffer , offset , count ) ; } else { int beforeEof = ( int ) ( fileLength - position ) ; raf . seek ( position ) ; raf . write ( buffer , offset , beforeEof ) ; raf . seek ( headerLength ) ; raf . write ( buffer , offset + beforeEof , count - beforeEof ) ; } } | Writes count bytes from buffer to position in file . Automatically wraps write if position is past the end of the file or if buffer overlaps it . |
31,583 | private void expandIfNecessary ( long dataLength ) throws IOException { long elementLength = Element . HEADER_LENGTH + dataLength ; long remainingBytes = remainingBytes ( ) ; if ( remainingBytes >= elementLength ) return ; long previousLength = fileLength ; long newLength ; do { remainingBytes += previousLength ; newLength = previousLength << 1 ; previousLength = newLength ; } while ( remainingBytes < elementLength ) ; setLength ( newLength ) ; long endOfLastElement = wrapPosition ( last . position + Element . HEADER_LENGTH + last . length ) ; long count = 0 ; if ( endOfLastElement <= first . position ) { FileChannel channel = raf . getChannel ( ) ; channel . position ( fileLength ) ; count = endOfLastElement - headerLength ; if ( channel . transferTo ( headerLength , count , channel ) != count ) { throw new AssertionError ( "Copied insufficient number of bytes!" ) ; } } if ( last . position < first . position ) { long newLastPosition = fileLength + last . position - headerLength ; writeHeader ( newLength , elementCount , first . position , newLastPosition ) ; last = new Element ( newLastPosition , last . length ) ; } else { writeHeader ( newLength , elementCount , first . position , last . position ) ; } fileLength = newLength ; if ( zero ) { ringErase ( headerLength , count ) ; } } | If necessary expands the file to accommodate an additional element of the given length . |
31,584 | @ SuppressWarnings ( { "unchecked" , "TypeParameterUnusedInFormals" } ) static < T extends Throwable > T getSneakyThrowable ( Throwable t ) throws T { throw ( T ) t ; } | Use this to throw checked exceptions from iterator methods that do not declare that they throw checked exceptions . |
31,585 | public float [ ] t1 ( float [ ] z , int k ) { float [ ] result = new float [ z . length ] ; System . arraycopy ( z , 0 , result , 0 , k ) ; for ( int i = k ; i < z . length ; i ++ ) { result [ i ] = ( new Transformations ( ) ) . sLinear ( z [ i ] , ( float ) 0.35 ) ; } return result ; } | WFG3 t1 transformation |
31,586 | public float [ ] t2 ( float [ ] z , int k ) { float [ ] result = new float [ z . length ] ; System . arraycopy ( z , 0 , result , 0 , k ) ; int l = z . length - k ; for ( int i = k + 1 ; i <= k + l / 2 ; i ++ ) { int head = k + 2 * ( i - k ) - 1 ; int tail = k + 2 * ( i - k ) ; float [ ] subZ = subVector ( z , head - 1 , tail - 1 ) ; result [ i - 1 ] = ( new Transformations ( ) ) . rNonsep ( subZ , 2 ) ; } return result ; } | WFG3 t2 transformation |
31,587 | public void removeDuplicatedAlgorithms ( ) { List < ExperimentAlgorithm < S , Result > > algorithmList = new ArrayList < > ( ) ; HashSet < String > algorithmTagList = new HashSet < > ( ) ; getAlgorithmList ( ) . removeIf ( alg -> ! algorithmTagList . add ( alg . getAlgorithmTag ( ) ) ) ; } | The list of algorithms contain an algorithm instance per problem . This is not convenient for calculating statistical data because a same algorithm will appear many times . This method remove duplicated algorithms and leave only an instance of each one . |
31,588 | protected void initializeUniformWeight ( ) { if ( ( problem . getNumberOfObjectives ( ) == 2 ) && ( populationSize <= 300 ) ) { for ( int n = 0 ; n < populationSize ; n ++ ) { double a = 1.0 * n / ( populationSize - 1 ) ; lambda [ n ] [ 0 ] = a ; lambda [ n ] [ 1 ] = 1 - a ; } } else { String dataFileName ; dataFileName = "W" + problem . getNumberOfObjectives ( ) + "D_" + populationSize + ".dat" ; try { InputStream in = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( dataDirectory + "/" + dataFileName ) ; InputStreamReader isr = new InputStreamReader ( in ) ; BufferedReader br = new BufferedReader ( isr ) ; int i = 0 ; int j = 0 ; String aux = br . readLine ( ) ; while ( aux != null ) { StringTokenizer st = new StringTokenizer ( aux ) ; j = 0 ; while ( st . hasMoreTokens ( ) ) { double value = new Double ( st . nextToken ( ) ) ; lambda [ i ] [ j ] = value ; j ++ ; } aux = br . readLine ( ) ; i ++ ; } br . close ( ) ; } catch ( Exception e ) { throw new JMetalException ( "initializeUniformWeight: failed when reading for file: " + dataDirectory + "/" + dataFileName , e ) ; } } } | Initialize weight vectors |
31,589 | @ SuppressWarnings ( "unchecked" ) protected void updateNeighborhood ( S individual , int subProblemId , NeighborType neighborType ) throws JMetalException { int size ; int time ; time = 0 ; if ( neighborType == NeighborType . NEIGHBOR ) { size = neighborhood [ subProblemId ] . length ; } else { size = population . size ( ) ; } int [ ] perm = new int [ size ] ; MOEADUtils . randomPermutation ( perm , size ) ; for ( int i = 0 ; i < size ; i ++ ) { int k ; if ( neighborType == NeighborType . NEIGHBOR ) { k = neighborhood [ subProblemId ] [ perm [ i ] ] ; } else { k = perm [ i ] ; } double f1 , f2 ; f1 = fitnessFunction ( population . get ( k ) , lambda [ k ] ) ; f2 = fitnessFunction ( individual , lambda [ k ] ) ; if ( f2 < f1 ) { population . set ( k , ( S ) individual . copy ( ) ) ; time ++ ; } if ( time >= maximumNumberOfReplacedSolutions ) { return ; } } } | Update neighborhood method |
31,590 | public void initPopulation ( ) { for ( int i = 0 ; i < populationSize ; i ++ ) { S newSolution = problem . createSolution ( ) ; problem . evaluate ( newSolution ) ; evaluations ++ ; population . add ( newSolution ) ; subregionIdx [ i ] [ i ] = 1 ; } } | Initialize the population |
31,591 | public double sumFitness ( int location ) { double sum = 0 ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ location ] [ i ] == 1 ) { sum = sum + fitnessFunction ( population . get ( i ) , lambda [ location ] ) ; } } return sum ; } | calculate the sum of fitnesses of solutions in the location subregion |
31,592 | public void deleteCrowdIndiv_same ( int crowdIdx , int nicheCount , double indivFitness , S indiv ) { ArrayList < Integer > indList = new ArrayList < > ( ) ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ crowdIdx ] [ i ] == 1 ) { indList . add ( i ) ; } } int listSize = indList . size ( ) ; int worstIdx = indList . get ( 0 ) ; double maxFitness = fitnessFunction ( population . get ( worstIdx ) , lambda [ crowdIdx ] ) ; for ( int i = 1 ; i < listSize ; i ++ ) { int curIdx = indList . get ( i ) ; double curFitness = fitnessFunction ( population . get ( curIdx ) , lambda [ crowdIdx ] ) ; if ( curFitness > maxFitness ) { worstIdx = curIdx ; maxFitness = curFitness ; } } if ( indivFitness < maxFitness ) { replace ( worstIdx , indiv ) ; } } | delete one solution from the most crowded subregion which is indiv s subregion . Compare indiv s fitness value and the worst one in this subregion |
31,593 | public void deleteCrowdIndiv_diff ( int crowdIdx , int curLocation , int nicheCount , S indiv ) { ArrayList < Integer > indList = new ArrayList < > ( ) ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ crowdIdx ] [ i ] == 1 ) { indList . add ( i ) ; } } int worstIdx = indList . get ( 0 ) ; double maxFitness = fitnessFunction ( population . get ( worstIdx ) , lambda [ crowdIdx ] ) ; for ( int i = 1 ; i < nicheCount ; i ++ ) { int curIdx = indList . get ( i ) ; double curFitness = fitnessFunction ( population . get ( curIdx ) , lambda [ crowdIdx ] ) ; if ( curFitness > maxFitness ) { worstIdx = curIdx ; maxFitness = curFitness ; } } replace ( worstIdx , indiv ) ; subregionIdx [ crowdIdx ] [ worstIdx ] = 0 ; subregionIdx [ curLocation ] [ worstIdx ] = 1 ; } | delete one solution from the most crowded subregion which is different from indiv s subregion . just use indiv to replace the worst solution in that subregion |
31,594 | public int countOnes ( int location ) { int count = 0 ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ location ] [ i ] == 1 ) { count ++ ; } } return count ; } | Count the number of 1s in the location th subregion |
31,595 | public int countRankOnes ( int location ) { int count = 0 ; for ( int i = 0 ; i < populationSize ; i ++ ) { if ( rankIdx [ location ] [ i ] == 1 ) { count ++ ; } } return count ; } | count the number of 1s in a row of rank matrix |
31,596 | public int findPosition ( S indiv ) { for ( int i = 0 ; i < populationSize ; i ++ ) { if ( indiv . equals ( population . get ( i ) ) ) { return i ; } } return - 1 ; } | find the index of the solution indiv in the population |
31,597 | public int findRegion ( int idx ) { for ( int i = 0 ; i < populationSize ; i ++ ) { if ( subregionIdx [ i ] [ idx ] == 1 ) { return i ; } } return - 1 ; } | find the subregion of the idx th solution in the population |
31,598 | public void setLocation ( S indiv , double [ ] z_ , double [ ] nz_ ) { int minIdx ; double distance , minDist ; minIdx = 0 ; distance = calculateDistance2 ( indiv , lambda [ 0 ] , z_ , nz_ ) ; minDist = distance ; for ( int i = 1 ; i < populationSize ; i ++ ) { distance = calculateDistance2 ( indiv , lambda [ i ] , z_ , nz_ ) ; if ( distance < minDist ) { minIdx = i ; minDist = distance ; } } indiv . setAttribute ( "region" , minIdx ) ; } | Set the location of a solution based on the orthogonal distance |
31,599 | public double innerproduct ( double [ ] vec1 , double [ ] vec2 ) { double sum = 0 ; for ( int i = 0 ; i < vec1 . length ; i ++ ) { sum += vec1 [ i ] * vec2 [ i ] ; } return sum ; } | Calculate the dot product of two vectors |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.