idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
5,500
public static int nvgraphExtractSubgraphByVertex ( nvgraphHandle handle , nvgraphGraphDescr descrG , nvgraphGraphDescr subdescrG , Pointer subvertices , long numvertices ) { return checkResult ( nvgraphExtractSubgraphByVertexNative ( handle , descrG , subdescrG , subvertices , numvertices ) ) ; }
create a new graph by extracting a subgraph given a list of vertices
5,501
public static int nvgraphExtractSubgraphByEdge ( nvgraphHandle handle , nvgraphGraphDescr descrG , nvgraphGraphDescr subdescrG , Pointer subedges , long numedges ) { return checkResult ( nvgraphExtractSubgraphByEdgeNative ( handle , descrG , subdescrG , subedges , numedges ) ) ; }
create a new graph by extracting a subgraph given a list of edges
5,502
public static int nvgraphSrSpmv ( nvgraphHandle handle , nvgraphGraphDescr descrG , long weight_index , Pointer alpha , long x_index , Pointer beta , long y_index , int SR ) { return checkResult ( nvgraphSrSpmvNative ( handle , descrG , weight_index , alpha , x_index , beta , y_index , SR ) ) ; }
nvGRAPH Semi - ring sparse matrix vector multiplication
5,503
public static int nvgraphWidestPath ( nvgraphHandle handle , nvgraphGraphDescr descrG , long weight_index , Pointer source_vert , long widest_path_index ) { return checkResult ( nvgraphWidestPathNative ( handle , descrG , weight_index , source_vert , widest_path_index ) ) ; }
nvGRAPH WidestPath Find widest path potential from source_index to every other vertices .
5,504
public static int nvgraphPagerank ( nvgraphHandle handle , nvgraphGraphDescr descrG , long weight_index , Pointer alpha , long bookmark_index , int has_guess , long pagerank_index , float tolerance , int max_iter ) { return checkResult ( nvgraphPagerankNative ( handle , descrG , weight_index , alpha , bookmark_index , ...
nvGRAPH PageRank Find PageRank for each vertex of a graph with a given transition probabilities a bookmark vector of dangling vertices and the damping factor .
5,505
public void setRegionCoverageSize ( int size ) { if ( size < 0 ) { return ; } int lg = ( int ) Math . ceil ( Math . log ( size ) / Math . log ( 2 ) ) ; int newRegionCoverageSize = 1 << lg ; int newRegionCoverageMask = newRegionCoverageSize - 1 ; RegionCoverage newCoverage = new RegionCoverage ( newRegionCoverageSize ) ...
Set size to the nearest upper 2^n number for quick modulus operation
5,506
public void attach ( JComponent owner ) { detach ( ) ; toolTipDialog = new TransparentToolTipDialog ( owner , new AnchorLink ( Anchor . CENTER_RIGHT , Anchor . CENTER_LEFT ) ) ; }
Attaches the tooltip sticker to the specified component .
5,507
protected String getToolTipText ( ) { String tip = null ; if ( toolTipDialog != null ) { tip = toolTipDialog . getText ( ) ; } return tip ; }
Gets the tooltip text to be displayed .
5,508
protected T construct ( ) { if ( _targetConstructor . isPresent ( ) ) { return _targetConstructor . get ( ) . apply ( this ) ; } try { final Constructor < ? extends T > constructor = _targetClass . get ( ) . getDeclaredConstructor ( this . getClass ( ) ) ; AccessController . doPrivileged ( ( PrivilegedAction < Object >...
Protected method to construct the target class reflectively from the specified type by passing its constructor an instance of this builder .
5,509
private void updateValue ( ) { if ( table != null ) { int oldCount = this . count ; this . count = table . getSelectedRowCount ( ) ; maybeNotifyListeners ( oldCount , count ) ; } }
Updates the value of this property based on the table s selection model and notify the listeners .
5,510
public static void katakanaToRomaji ( Appendable builder , CharSequence s ) throws IOException { ToStringUtil . getRomanization ( builder , s ) ; }
Romanize katakana with modified hepburn
5,511
private DetailAST getExprAst ( final DetailAST pAst ) { DetailAST result = null ; for ( DetailAST a = pAst . getFirstChild ( ) ; a != null ; a = a . getNextSibling ( ) ) { if ( a . getType ( ) != TokenTypes . LPAREN && a . getType ( ) != TokenTypes . RPAREN ) { result = a ; break ; } } return result ; }
Find the meaningful child of an EXPR AST . This is usually the only child present but it may be surrounded by parentheses .
5,512
public QueryResult < T > first ( ) { if ( response != null && response . size ( ) > 0 ) { return response . get ( 0 ) ; } return null ; }
This method just returns the first QueryResult of response or null if response is null or empty .
5,513
private void attach ( JComponent componentToBeDecorated ) { detach ( ) ; decoratedComponent = componentToBeDecorated ; if ( decoratedComponent != null ) { decoratedComponent . addComponentListener ( decoratedComponentTracker ) ; decoratedComponent . addAncestorListener ( decoratedComponentTracker ) ; decoratedComponent...
Attaches the decoration to the specified component .
5,514
private void detach ( ) { if ( decoratedComponent != null ) { decoratedComponent . removeComponentListener ( decoratedComponentTracker ) ; decoratedComponent . removeAncestorListener ( decoratedComponentTracker ) ; decoratedComponent . removeHierarchyBoundsListener ( decoratedComponentTracker ) ; decoratedComponent . r...
Detaches the decoration from the decorated component .
5,515
private void attachToLayeredPane ( ) { Container ancestor = SwingUtilities . getAncestorOfClass ( JLayeredPane . class , decoratedComponent ) ; if ( ancestor instanceof JLayeredPane ) { attachedLayeredPane = ( JLayeredPane ) ancestor ; Integer layer = getDecoratedComponentLayerInLayeredPane ( attachedLayeredPane ) ; at...
Inserts the decoration to the layered pane right above the decorated component .
5,516
private Integer getDecoratedComponentLayerInLayeredPane ( JLayeredPane layeredPane ) { Container ancestorInLayer = decoratedComponent ; while ( ! layeredPane . equals ( ancestorInLayer . getParent ( ) ) ) { ancestorInLayer = ancestorInLayer . getParent ( ) ; } return ( layeredPane . getLayer ( ancestorInLayer ) + DECOR...
Retrieves the layer index of the decorated component in the layered pane of the window .
5,517
private void updateDecorationPainterVisibility ( ) { boolean shouldBeVisible = ( decoratedComponent != null ) && ( paintWhenDisabled || decoratedComponent . isEnabled ( ) ) && decoratedComponent . isShowing ( ) && visible ; if ( shouldBeVisible != decorationPainter . isVisible ( ) ) { decorationPainter . setVisible ( s...
Updates the visibility of the decoration painter according to the visible state set by the programmer and the state of the decorated component .
5,518
private void followDecoratedComponent ( JLayeredPane layeredPane ) { Point relativeLocationToOwner = anchorLink . getRelativeSlaveLocation ( decoratedComponent . getWidth ( ) , decoratedComponent . getHeight ( ) , getWidth ( ) , getHeight ( ) ) ; updateDecorationPainterUnclippedBounds ( layeredPane , relativeLocationTo...
Updates the decoration painter in the specified layered pane .
5,519
private void updateDecorationPainterUnclippedBounds ( JLayeredPane layeredPane , Point relativeLocationToOwner ) { Rectangle decorationBoundsInLayeredPane ; if ( layeredPane == null ) { decorationBoundsInLayeredPane = new Rectangle ( ) ; } else { Point decoratedComponentLocationInLayeredPane = SwingUtilities . convertP...
Calculates and updates the unclipped bounds of the decoration painter in layered pane coordinates .
5,520
private void updateDecorationPainterClippedBounds ( JLayeredPane layeredPane , Point relativeLocationToOwner ) { if ( layeredPane == null ) { decorationPainter . setClipBounds ( null ) ; } else { JComponent clippingComponent = getEffectiveClippingAncestor ( ) ; if ( clippingComponent == null ) { LOGGER . error ( "No de...
Calculates and updates the clipped bounds of the decoration painter in layered pane coordinates .
5,521
private void setDefaultFonts ( BrowserConfig config ) { config . setDefaultFont ( Font . SERIF , "Times New Roman" ) ; config . setDefaultFont ( Font . SANS_SERIF , "Arial" ) ; config . setDefaultFont ( Font . MONOSPACED , "Courier New" ) ; }
Sets some common fonts as the defaults for generic font families .
5,522
public void addResultCollector ( ResultCollector < ? , DPO > resultCollector ) { if ( resultCollector != null ) { addTrigger ( resultCollector ) ; addDataProvider ( resultCollector ) ; } }
Adds the specified result collector to the triggers and data providers .
5,523
public void removeResultCollector ( ResultCollector < ? , DPO > resultCollector ) { if ( resultCollector != null ) { removeTrigger ( resultCollector ) ; removeDataProvider ( resultCollector ) ; } }
Removes the specified result collector from the triggers and data providers .
5,524
public Transformer [ ] getDataProviderOutputTransformers ( ) { Transformer [ ] transformers ; if ( dataProviderOutputTransformers == null ) { transformers = null ; } else { transformers = dataProviderOutputTransformers . toArray ( new Transformer [ dataProviderOutputTransformers . size ( ) ] ) ; } return transformers ;...
Gets the transformers transforming the output of each data provider before they are mapped to the rules .
5,525
@ SuppressWarnings ( "unchecked" ) private void processEachDataProviderWithEachRule ( ) { for ( DataProvider < DPO > dataProvider : dataProviders ) { Object transformedOutput = dataProvider . getData ( ) ; if ( dataProviderOutputTransformers != null ) { for ( Transformer transformer : dataProviderOutputTransformers ) {...
Processes the output of each data provider one by one with each rule .
5,526
@ SuppressWarnings ( "unchecked" ) private void processAllDataProvidersWithEachRule ( ) { List < Object > transformedDataProvidersOutput = new ArrayList < Object > ( dataProviders . size ( ) ) ; for ( DataProvider < DPO > dataProvider : dataProviders ) { Object transformedOutput = dataProvider . getData ( ) ; if ( data...
Processes the output of all data providers all at once with each rule .
5,527
private void processRules ( RI ruleInput ) { switch ( ruleToResultHandlerMapping ) { case SPLIT : processEachRuleWithEachResultHandler ( ruleInput ) ; break ; case JOIN : processAllRulesWithEachResultHandler ( ruleInput ) ; break ; default : LOGGER . error ( "Unsupported " + MappingStrategy . class . getSimpleName ( ) ...
Processes the specified rule input .
5,528
@ SuppressWarnings ( "unchecked" ) private void processEachRuleWithEachResultHandler ( RI ruleInput ) { for ( Rule < RI , RO > rule : rules ) { Object ruleOutput = rule . validate ( ruleInput ) ; if ( ruleOutputTransformers != null ) { for ( Transformer transformer : ruleOutputTransformers ) { ruleOutput = transformer ...
Processes the specified rule input with each rule and processes the results of each rule one by one with each result handler .
5,529
@ SuppressWarnings ( "unchecked" ) private void processAllRulesWithEachResultHandler ( RI ruleInput ) { List < Object > combinedRulesOutput = new ArrayList < Object > ( rules . size ( ) ) ; for ( Rule < RI , RO > rule : rules ) { Object data = rule . validate ( ruleInput ) ; if ( ruleOutputTransformers != null ) { for ...
Processes the specified rule input with each rule and processes the result of all rules all at once with each result handler .
5,530
private void processResultHandlers ( RHI resultHandlerInput ) { for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( resultHandlerInput ) ; } }
Processes the specified result handler input with each result handler .
5,531
private void dispose ( Collection < Transformer > elements ) { if ( elements != null ) { for ( Transformer < ? , ? > element : elements ) { if ( element instanceof Disposable ) { ( ( Disposable ) element ) . dispose ( ) ; } } elements . clear ( ) ; } }
Disposes the elements of the specified collection .
5,532
private AnchorLink getAbsoluteAnchorLinkWithCell ( int dragOffsetX ) { AnchorLink absoluteAnchorLink ; TableModel tableModel = table . getModel ( ) ; if ( ( 0 <= modelRowIndex ) && ( modelRowIndex < tableModel . getRowCount ( ) ) && ( 0 <= modelColumnIndex ) && ( modelColumnIndex < tableModel . getColumnCount ( ) ) ) {...
Retrieves the absolute anchor link to attach the decoration to the cell .
5,533
public static List < FacetQueryResult . Field > convert ( QueryResponse solrResponse , Map < String , String > alias ) { if ( solrResponse == null || solrResponse . getResponse ( ) == null || solrResponse . getResponse ( ) . get ( "facets" ) == null ) { return null ; } if ( alias == null ) { alias = new HashMap < > ( )...
Convert a generic solrResponse into our FacetQueryResult .
5,534
private static int getBucketCount ( SimpleOrderedMap < Object > solrFacets , int defaultCount ) { List < SimpleOrderedMap < Object > > solrBuckets = ( List < SimpleOrderedMap < Object > > ) solrFacets . get ( "buckets" ) ; if ( solrBuckets == null ) { for ( int i = 0 ; i < solrFacets . size ( ) ; i ++ ) { if ( solrFace...
In order to process type = query facets with a nested type = range .
5,535
@ SuppressWarnings ( "unused" ) public void printAll ( ) { project . getLogger ( ) . lifecycle ( "Full contents of dependency configurations:" ) ; project . getLogger ( ) . lifecycle ( "-------------------------------------------" ) ; for ( final Map . Entry < String , DependencyConfig > entry : depConfigs . entrySet (...
Prints all dependency configurations with full contents for debugging purposes .
5,536
private void updateValue ( Point location ) { CellPosition oldValue = value ; if ( location == null ) { value = null ; } else { int row = table . rowAtPoint ( location ) ; int column = table . columnAtPoint ( location ) ; value = new CellPosition ( row , column ) ; } maybeNotifyListeners ( oldValue , value ) ; }
Updates the value of this property based on the location of the mouse pointer .
5,537
public void preparePartitions ( Map config , int totalTasks , int taskIndex , SpoutOutputCollector collector ) throws Exception { this . collector = collector ; if ( stateStore == null ) { String zkEndpointAddress = eventHubConfig . getZkConnectionString ( ) ; if ( zkEndpointAddress == null || zkEndpointAddress . lengt...
This is a extracted method that is easy to test
5,538
public void propertyChange ( PropertyChangeEvent propertyChangeEvent ) { if ( ( triggerProperties == null ) || triggerProperties . isEmpty ( ) || triggerProperties . contains ( propertyChangeEvent . getPropertyName ( ) ) ) { fireTriggerEvent ( new TriggerEvent ( propertyChangeEvent . getSource ( ) ) ) ; } }
Triggers the validation when the property change event is received .
5,539
public boolean existsCore ( String coreName ) { try { CoreStatus status = CoreAdminRequest . getCoreStatus ( coreName , solrClient ) ; status . getInstanceDirectory ( ) ; } catch ( Exception e ) { return false ; } return true ; }
Check if a given core exists .
5,540
public boolean existsCollection ( String collectionName ) throws SolrException { try { List < String > collections = CollectionAdminRequest . listCollections ( solrClient ) ; for ( String collection : collections ) { if ( collection . equals ( collectionName ) ) { return true ; } } return false ; } catch ( Exception e ...
Check if a given collection exists .
5,541
public void removeCollection ( String collectionName ) throws SolrException { try { CollectionAdminRequest request = CollectionAdminRequest . deleteCollection ( collectionName ) ; request . process ( solrClient ) ; } catch ( SolrServerException | IOException e ) { throw new SolrException ( SolrException . ErrorCode . S...
Remove a collection .
5,542
public void removeCore ( String coreName ) throws SolrException { try { CoreAdminRequest . unloadCore ( coreName , true , true , solrClient ) ; } catch ( SolrServerException | IOException e ) { throw new SolrException ( SolrException . ErrorCode . SERVER_ERROR , e . getMessage ( ) , e ) ; } }
Remove a core .
5,543
public synchronized static void install ( ) { if ( ! isInstalled ( ) ) { InputStream is = BMPCLocalLauncher . class . getResourceAsStream ( BMP_LOCAL_ZIP_RES ) ; try { unzip ( is , BMPC_USER_DIR ) ; new File ( BMP_LOCAL_EXEC_UNIX ) . setExecutable ( true ) ; new File ( BMP_LOCAL_EXEC_WIN ) . setExecutable ( true ) ; in...
Install Local BrowserMob Proxy .
5,544
public synchronized static String installedVersion ( ) { BufferedReader versionReader = null ; try { versionReader = new BufferedReader ( new FileReader ( BMP_LOCAL_VERSION_FILE ) ) ; String version = versionReader . readLine ( ) ; if ( null == version ) throw new Exception ( ) ; return version ; } catch ( Exception e ...
Installed version of Local BrowserMob Proxy
5,545
private synchronized static void delete ( File file ) { if ( file . isDirectory ( ) ) { File [ ] files = file . listFiles ( ) ; for ( int i = 0 ; i < files . length ; ++ i ) { delete ( files [ i ] ) ; } file . delete ( ) ; } else { file . delete ( ) ; } }
Delete file recursively if needed
5,546
public List < LuceneToken > parse ( String fieldName , String text ) throws IOException { return readTokens ( analyzer . tokenStream ( fieldName , text ) ) ; }
Parses one line of text
5,547
public void handleResult ( RHI result ) { for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( result ) ; } }
Processes the specified result using all delegate result handlers .
5,548
public static Set < File > getPublishedDependencyLibs ( final Task pTask , final DependencyConfig pDepConfig ) { Set < File > result = new HashSet < > ( ) ; Configuration cfg = new ClasspathBuilder ( pTask . getProject ( ) ) . buildMainRuntimeConfiguration ( pDepConfig ) ; for ( ResolvedDependency dep : cfg . getResolv...
Scan the dependencies of the specified configurations and return a list of File objects for each dependency . Resolves the configurations if they are still unresolved .
5,549
protected void processTrigger ( final Trigger trigger ) { final List < DataProvider < RI > > mappedDataProviders = triggersToDataProviders . get ( trigger ) ; if ( ( mappedDataProviders == null ) || mappedDataProviders . isEmpty ( ) ) { LOGGER . warn ( "No matching data provider in mappable validator for trigger: " + t...
Processes the specified trigger by finding all the mapped data providers and so on .
5,550
private void processDataProvider ( final DataProvider < RI > dataProvider ) { final List < Rule < RI , RO > > mappedRules = dataProvidersToRules . get ( dataProvider ) ; if ( ( mappedRules == null ) || mappedRules . isEmpty ( ) ) { LOGGER . warn ( "No matching rule in mappable validator for data provider: " + dataProvi...
Process the specified data provider by finding all the mapped rules and so on .
5,551
private void processRule ( final Rule < RI , RO > rule , final RI data ) { final List < ResultHandler < RO > > mappedResultHandlers = rulesToResultHandlers . get ( rule ) ; if ( ( mappedResultHandlers == null ) || mappedResultHandlers . isEmpty ( ) ) { LOGGER . warn ( "No matching result handler in mappable validator f...
Processes the specified rule by finding all the mapped results handlers checking the rule and processing the rule result using all found result handlers .
5,552
public ValidatorContext < D , O > handleWith ( final ResultHandler < O > ... resultHandlers ) { if ( resultHandlers != null ) { Collections . addAll ( registeredResultHandlers , resultHandlers ) ; } return this ; }
Adds more result handlers to the validator .
5,553
static String buildCombinedType ( String eventType , Optional < String > objectType ) { return Joiner . on ( "/" ) . skipNulls ( ) . join ( eventType , objectType . orNull ( ) ) ; }
Combines event and object type into a single type string .
5,554
static String buildVirtualPageTitle ( Map < String , String > metadata ) { checkNotNull ( metadata ) ; List < String > escapedMetadata = new ArrayList < > ( ) ; for ( Map . Entry < String , String > entry : metadata . entrySet ( ) ) { escapedMetadata . add ( METADATA_ESCAPER . escape ( entry . getKey ( ) ) + "=" + META...
Creates a virtual page title from a set of metadata key - value pairs .
5,555
static ImmutableList < NameValuePair > buildParameters ( String analyticsId , String clientId , String virtualPageName , String virtualPageTitle , String eventType , String eventName , boolean isUserSignedIn , boolean isUserInternal , Optional < Boolean > isUserTrialEligible , Optional < String > projectNumberHash , Op...
Creates the parameters required to record the Google Analytics event .
5,556
public RuleContext < D > read ( final DataProvider < D > ... dataProviders ) { if ( dataProviders != null ) { Collections . addAll ( registeredDataProviders , dataProviders ) ; } return this ; }
Adds more data providers to the validator .
5,557
private void updateFromProperties ( ) { List < R > newValues = new ArrayList < R > ( ) ; for ( ReadableProperty < R > master : properties ) { newValues . add ( master . getValue ( ) ) ; } setValue ( newValues ) ; }
Updates the current collection of values from the sub - properties and notifies the listeners .
5,558
private void dispose ( Collection < ? > elements ) { for ( Object element : elements ) { if ( element instanceof Disposable ) { ( ( Disposable ) element ) . dispose ( ) ; } } dataProviders . clear ( ) ; }
Clears all elements from the specified collection .
5,559
private void init ( ReadableProperty < MO > master , Transformer < MO , SI > transformer , WritableProperty < SI > slave ) { this . master = master ; this . transformer = transformer ; this . slave = slave ; master . addValueChangeListener ( masterAdapter ) ; updateSlaves ( master . getValue ( ) ) ; }
Initializes the bond .
5,560
private void updateSlaves ( MO masterOutputValue ) { SI slaveInputValue = transformer . transform ( masterOutputValue ) ; slave . setValue ( slaveInputValue ) ; }
Sets the value of the slaves according the value of the master .
5,561
private ITridentPartitionManager getOrCreatePartitionManager ( Partition partition ) { ITridentPartitionManager pm ; if ( ! pmMap . containsKey ( partition . getId ( ) ) ) { IEventHubReceiver receiver = recvFactory . create ( spoutConfig , partition . getId ( ) ) ; pm = pmFactory . create ( receiver ) ; pmMap . put ( p...
Check if partition manager for a given partiton is created if not create it .
5,562
public DataProviderContext on ( final Trigger ... triggers ) { final List < Trigger > registeredTriggers = new ArrayList < Trigger > ( ) ; if ( triggers != null ) { Collections . addAll ( registeredTriggers , triggers ) ; } return new DataProviderContext ( registeredTriggers ) ; }
Adds the first triggers to the validator .
5,563
public static JMDictSense create ( ) { if ( index >= instances . size ( ) ) { instances . add ( new JMDictSense ( ) ) ; } return instances . get ( index ++ ) ; }
Returns a JMDictSense object a new one of an existing one
5,564
public static void clear ( ) { for ( int i = 0 ; i < index ; ++ i ) { instances . get ( i ) . clear ( ) ; } index = 0 ; }
Reset all created JMDictSense object so that they can be reused
5,565
public Point getRelativeSlaveLocation ( final Component masterComponent , final Component slaveComponent ) { return getRelativeSlaveLocation ( masterComponent . getWidth ( ) , masterComponent . getHeight ( ) , slaveComponent . getWidth ( ) , slaveComponent . getHeight ( ) ) ; }
Computes the location of the specified component that is slaved to the specified master component using this anchor link .
5,566
private void unhookFromTrigger ( final T trigger ) { final TriggerListener triggerAdapter = triggersToTriggerAdapters . get ( trigger ) ; trigger . removeTriggerListener ( triggerAdapter ) ; if ( ! triggersToTriggerAdapters . containsKey ( trigger ) ) { triggersToTriggerAdapters . remove ( trigger ) ; } }
De - registers the trigger listener .
5,567
private void unmapTriggerFromAllDataProviders ( final T trigger ) { if ( trigger != null ) { unhookFromTrigger ( trigger ) ; triggersToDataProviders . remove ( trigger ) ; } }
Disconnects the specified trigger from all data providers .
5,568
private void unmapDataProviderFromAllTriggers ( final DP dataProvider ) { if ( dataProvider != null ) { for ( final List < DP > mappedDataProviders : triggersToDataProviders . values ( ) ) { mappedDataProviders . remove ( dataProvider ) ; } } }
Disconnects the specified data providers from all triggers .
5,569
private void unmapRuleFromAllDataProviders ( final R rule ) { if ( rule != null ) { for ( final List < R > mappedRules : dataProvidersToRules . values ( ) ) { mappedRules . remove ( rule ) ; } } }
Disconnects the specified rule from all data providers .
5,570
private void unmapResultHandlerFromAllRules ( final RH resultHandler ) { if ( resultHandler != null ) { for ( final List < RH > mappedResultHandlers : rulesToResultHandlers . values ( ) ) { mappedResultHandlers . remove ( resultHandler ) ; } } }
Disconnects the specified result handler from all rules .
5,571
private void disposeTriggersAndDataProviders ( ) { for ( final Map . Entry < T , List < DP > > entry : triggersToDataProviders . entrySet ( ) ) { unhookFromTrigger ( entry . getKey ( ) ) ; final T trigger = entry . getKey ( ) ; if ( trigger instanceof Disposable ) { ( ( Disposable ) trigger ) . dispose ( ) ; } final Li...
Disposes all triggers and data providers that are mapped to each other .
5,572
private void disposeRulesAndResultHandlers ( ) { for ( final Map . Entry < R , List < RH > > entry : rulesToResultHandlers . entrySet ( ) ) { final R rule = entry . getKey ( ) ; if ( rule instanceof Disposable ) { ( ( Disposable ) rule ) . dispose ( ) ; } final List < RH > resultHandlers = entry . getValue ( ) ; if ( r...
Disposes all rules and result handlers that are mapped to each other .
5,573
private void setValue ( boolean rollover ) { if ( ! ValueUtils . areEqual ( this . rollover , rollover ) ) { boolean oldValue = this . rollover ; this . rollover = rollover ; maybeNotifyListeners ( oldValue , rollover ) ; } }
Applies the specified value and notifies the value change listeners if needed .
5,574
private GeneralValidator < DPO , RI , RO , RHI > build ( ) { GeneralValidator < DPO , RI , RO , RHI > validator = new GeneralValidator < DPO , RI , RO , RHI > ( ) ; for ( Trigger trigger : addedTriggers ) { validator . addTrigger ( trigger ) ; } for ( DataProvider < DPO > dataProvider : addedDataProviders ) { validator...
Builds the validator .
5,575
public Proxy asSeleniumProxy ( ) { Proxy seleniumProxyConfig = new Proxy ( ) ; seleniumProxyConfig . setProxyType ( Proxy . ProxyType . MANUAL ) ; seleniumProxyConfig . setHttpProxy ( asHostAndPort ( ) ) ; return seleniumProxyConfig ; }
Returns the Proxy this client wraps in form of a Selenium Proxy configuration object .
5,576
public JsonObject newHar ( String initialPageRef , boolean captureHeaders , boolean captureContent , boolean captureBinaryContent ) { try { HttpPut request = new HttpPut ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har" ) . build ( ) ) ; applyFormParamsToHttpRequest ( request , new BasicNameValuePair ( "ini...
Creates a new HAR attached to the proxy .
5,577
public void newPage ( String pageRef ) { try { HttpPut request = new HttpPut ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har/pageRef" ) . build ( ) ) ; applyFormParamsToHttpRequest ( request , new BasicNameValuePair ( "pageRef" , pageRef ) ) ; CloseableHttpResponse response = HTTPclient . execute ( request...
Starts a new page on the existing HAR . All the traffic recorded in the HAR from this point on will be considered part of this new Page .
5,578
public JsonObject har ( ) { try { HttpGet request = new HttpGet ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har" ) . build ( ) ) ; CloseableHttpResponse response = HTTPclient . execute ( request ) ; JsonObject har = httpResponseToJsonObject ( response ) ; response . close ( ) ; return har ; } catch ( Excep...
Produces the HAR so far based on the traffic generated so far .
5,579
public static void harToFile ( JsonObject har , String destinationDir , String destinationFile ) { File harDestinationDir = new File ( destinationDir ) ; if ( ! harDestinationDir . exists ( ) ) harDestinationDir . mkdirs ( ) ; PrintWriter harDestinationFileWriter = null ; try { harDestinationFileWriter = new PrintWrite...
Utility to store HAR to file .
5,580
protected void processResult ( RO result ) { for ( ResultHandler < RO > resultHandler : resultHandlers ) { resultHandler . handleResult ( result ) ; } }
Handles the specified result using all result handlers .
5,581
public void setupCrossCheckTasks ( ) { final TaskContainer tasks = project . getTasks ( ) ; final Task xtest = tasks . create ( XTEST_TASK_NAME ) ; xtest . setGroup ( XTEST_GROUP_NAME ) ; xtest . setDescription ( "Run the unit tests against all supported Checkstyle runtimes" ) ; tasks . getByName ( JavaBasePlugin . BUI...
Set up cross - check feature . We provide an xcheck task which depends on a number of Test tasks that run the unit tests compiled against every Checkstyle version against all the other Checkstyle libraries . In this way we find out which versions are compatible .
5,582
public void adjustTaskGroupAssignments ( ) { final TaskContainer tasks = project . getTasks ( ) ; tasks . getByName ( BasePlugin . ASSEMBLE_TASK_NAME ) . setGroup ( ARTIFACTS_GROUP_NAME ) ; tasks . getByName ( JavaPlugin . JAR_TASK_NAME ) . setGroup ( ARTIFACTS_GROUP_NAME ) ; final SourceSet sqSourceSet = buildUtil . g...
Assign some standard tasks and tasks created by third - party plugins to their task groups according to the order of things for Checkstyle Addons .
5,583
public ResultHandlerContext < D , O > check ( final Rule < D , O > ... rules ) { if ( rules != null ) { Collections . addAll ( registeredRules , rules ) ; } return this ; }
Adds another rule to the validator .
5,584
public static ImageIcon loadImageIcon ( final String iconName , final Class < ? > clazz ) { ImageIcon icon = null ; if ( iconName != null ) { final URL iconResource = clazz . getResource ( iconName ) ; if ( iconResource == null ) { LOGGER . error ( "Icon could not be loaded: '" + iconName ) ; icon = null ; } else { ico...
Loads an image icon from a resource file .
5,585
public static Map < String , String > mfAttrStd ( final Project pProject ) { Map < String , String > result = new HashMap < > ( ) ; result . put ( "Manifest-Version" , "1.0" ) ; result . put ( "Website" , new BuildUtil ( pProject ) . getExtraPropertyValue ( ExtProp . Website ) ) ; result . put ( "Created-By" , GradleVe...
Build a little map with standard manifest attributes .
5,586
private void updateValue ( ) { if ( table != null ) { int oldCount = this . count ; this . count = table . getRowCount ( ) ; maybeNotifyListeners ( oldCount , count ) ; } }
Updates the value of this property and notify the listeners .
5,587
private static boolean queryParamsOperatorAlwaysMatchesOperator ( QueryParam . Type type , List < String > queryParamList , ComparisonOperator operator ) { for ( String queryItem : queryParamList ) { Matcher matcher = getPattern ( type ) . matcher ( queryItem ) ; String op = "" ; if ( matcher . find ( ) ) { op = matche...
Auxiliary method to check if the operator of each of the values in the queryParamList matches the operator passed .
5,588
private static List < Object > removeOperatorsFromQueryParamList ( QueryParam . Type type , List < String > queryParamList ) { List < Object > newQueryParamList = new ArrayList < > ( ) ; for ( String queryItem : queryParamList ) { Matcher matcher = getPattern ( type ) . matcher ( queryItem ) ; String queryValueString =...
Removes any operators present in the queryParamList and gets a list of the values parsed to the corresponding data type .
5,589
private static Bson createDateFilter ( String mongoDbField , List < String > dateValues , ComparisonOperator comparator , QueryParam . Type type ) { Bson filter = null ; Object date = null ; if ( QueryParam . Type . DATE . equals ( type ) ) { date = convertStringToDate ( dateValues . get ( 0 ) ) ; } else if ( QueryPara...
Generates a date filter .
5,590
public static LogicalOperator checkOperator ( String value ) throws IllegalArgumentException { boolean containsOr = value . contains ( OR ) ; boolean containsAnd = value . contains ( AND ) ; if ( containsAnd && containsOr ) { throw new IllegalArgumentException ( "Cannot merge AND and OR operators in the same query filt...
Checks that the filter value list contains only one type of operations .
5,591
public EasyJaSubDictionaryEntry getEntry ( String word ) { if ( word == null || word . length ( ) == 0 ) { throw new RuntimeException ( "Invalid word" ) ; } EasyJaSubTrie . Value < EasyJaSubDictionaryEntry > value = trie . get ( new CharacterIterator ( word ) ) ; if ( value == null ) { return null ; } return value . ge...
Returns an entry corresponding to specified word or to a prefix of it
5,592
@ SuppressWarnings ( "unchecked" ) public < T > T getExtraPropertyValue ( final ExtProp pExtraPropName ) { ExtraPropertiesExtension extraProps = project . getExtensions ( ) . getByType ( ExtraPropertiesExtension . class ) ; if ( extraProps . has ( pExtraPropName . getPropertyName ( ) ) ) { return ( T ) extraProps . get...
Read the value of an extra property of the project .
5,593
public Task getTask ( final TaskNames pTaskName , final DependencyConfig pDepConfig ) { return project . getTasks ( ) . getByName ( pTaskName . getName ( pDepConfig ) ) ; }
Convenience method for getting a specific task directly .
5,594
public void addBuildTimestampDeferred ( final Task pTask , final Attributes pAttributes ) { pTask . doFirst ( new Closure < Void > ( pTask ) { @ SuppressWarnings ( "MethodDoesntCallSuperMethod" ) public Void call ( ) { addBuildTimestamp ( pAttributes ) ; return null ; } } ) ; }
Add build timestamp to some manifest attributes in the execution phase so that it does not count for the up - to - date check .
5,595
public void inheritManifest ( final Jar pTask , final DependencyConfig pDepConfig ) { pTask . doFirst ( new Closure < Void > ( pTask ) { @ SuppressWarnings ( "MethodDoesntCallSuperMethod" ) public Void call ( ) { final Jar jarTask = ( Jar ) getTask ( TaskNames . jar , pDepConfig ) ; pTask . setManifest ( jarTask . getM...
Make the given Jar task inherit its manifest from the main thin Jar task . Also set the build timestamp .
5,596
public Point getAnchorPoint ( int width , int height ) { return new Point ( ( int ) ( relativeX * width + offsetX ) , ( int ) ( relativeY * height + offsetY ) ) ; }
Retrieves a point on an object of the specified size .
5,597
public void setInhibited ( boolean inhibited ) { boolean wasInhibited = this . inhibited ; this . inhibited = inhibited ; if ( wasInhibited && ! inhibited ) { if ( inhibitCount > 0 ) { maybeNotifyListeners ( lastNonInhibitedValue , lastInhibitedValue ) ; } inhibitCount = 0 ; } }
States whether this property should be inhibited .
5,598
private void notifyListenersIfUninhibited ( R oldValue , R newValue ) { if ( inhibited ) { inhibitCount ++ ; lastInhibitedValue = newValue ; } else { lastInhibitedValue = newValue ; lastNonInhibitedValue = newValue ; doNotifyListeners ( oldValue , newValue ) ; } }
Notifies the listeners that the property value has changed if the property is not inhibited .
5,599
private void doNotifyListeners ( R oldValue , R newValue ) { List < ValueChangeListener < R > > listenersCopy = new ArrayList < ValueChangeListener < R > > ( listeners ) ; notifyingListeners = true ; for ( ValueChangeListener < R > listener : listenersCopy ) { listener . valueChanged ( this , oldValue , newValue ) ; } ...
Notifies the listeners that the property value has changed unconditionally .