idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
5,500
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 .
282
24
5,501
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 .
50
19
5,502
public static void katakanaToRomaji ( Appendable builder , CharSequence s ) throws IOException { ToStringUtil . getRomanization ( builder , s ) ; }
Romanize katakana with modified hepburn
40
10
5,503
@ CheckForNull private DetailAST getExprAst ( @ Nonnull 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 r...
Find the meaningful child of an EXPR AST . This is usually the only child present but it may be surrounded by parentheses .
102
25
5,504
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 .
38
19
5,505
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 .
139
9
5,506
private void detach ( ) { // Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach()) if ( decoratedComponent != null ) { decoratedComponent . removeComponentListener ( decoratedComponentTracker ) ; decoratedComponent . removeAncestorListener ( decoratedComponentTrack...
Detaches the decoration from the decorated component .
150
9
5,507
private void attachToLayeredPane ( ) { // Get ancestor layered pane that will get the decoration holder component Container ancestor = SwingUtilities . getAncestorOfClass ( JLayeredPane . class , decoratedComponent ) ; if ( ancestor instanceof JLayeredPane ) { attachedLayeredPane = ( JLayeredPane ) ancestor ; Integer l...
Inserts the decoration to the layered pane right above the decorated component .
155
14
5,508
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 .
93
18
5,509
private void updateDecorationPainterVisibility ( ) { boolean shouldBeVisible = ( decoratedComponent != null ) && // ( paintWhenDisabled || decoratedComponent . isEnabled ( ) ) && // decoratedComponent . isShowing ( ) && // visible ; if ( shouldBeVisible != decorationPainter . isVisible ( ) ) { decorationPainter . setVi...
Updates the visibility of the decoration painter according to the visible state set by the programmer and the state of the decorated component .
87
25
5,510
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 .
136
11
5,511
private void updateDecorationPainterUnclippedBounds ( JLayeredPane layeredPane , Point relativeLocationToOwner ) { Rectangle decorationBoundsInLayeredPane ; if ( layeredPane == null ) { decorationBoundsInLayeredPane = new Rectangle ( ) ; } else { // Calculate location of the decorated component in the layered pane cont...
Calculates and updates the unclipped bounds of the decoration painter in layered pane coordinates .
219
19
5,512
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 .
479
17
5,513
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 .
72
13
5,514
public void addResultCollector ( ResultCollector < ? , DPO > resultCollector ) { if ( resultCollector != null ) { addTrigger ( resultCollector ) ; addDataProvider ( resultCollector ) ; } }
Adds the specified result collector to the triggers and data providers .
49
12
5,515
public void removeResultCollector ( ResultCollector < ? , DPO > resultCollector ) { if ( resultCollector != null ) { removeTrigger ( resultCollector ) ; removeDataProvider ( resultCollector ) ; } }
Removes the specified result collector from the triggers and data providers .
49
13
5,516
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 .
74
20
5,517
@ SuppressWarnings ( "unchecked" ) // NOSONAR (Avoid Duplicate Literals) private void processEachDataProviderWithEachRule ( ) { // For each data provider for ( DataProvider < DPO > dataProvider : dataProviders ) { // Get the data provider output Object transformedOutput = dataProvider . getData ( ) ; // Transform the d...
Processes the output of each data provider one by one with each rule .
190
15
5,518
@ SuppressWarnings ( "unchecked" ) // NOSONAR (Avoid Duplicate Literals) private void processAllDataProvidersWithEachRule ( ) { // For each data provider List < Object > transformedDataProvidersOutput = new ArrayList < Object > ( dataProviders . size ( ) ) ; for ( DataProvider < DPO > dataProvider : dataProviders ) { /...
Processes the output of all data providers all at once with each rule .
255
15
5,519
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 .
95
7
5,520
@ SuppressWarnings ( "unchecked" ) // NOSONAR (Avoid Duplicate Literals) private void processEachRuleWithEachResultHandler ( RI ruleInput ) { // For each rule for ( Rule < RI , RO > rule : rules ) { // Validate the data and get the rule output Object ruleOutput = rule . validate ( ruleInput ) ; // Transform the rule ou...
Processes the specified rule input with each rule and processes the results of each rule one by one with each result handler .
200
24
5,521
@ SuppressWarnings ( "unchecked" ) // NOSONAR (Avoid Duplicate Literals) private void processAllRulesWithEachResultHandler ( RI ruleInput ) { // For each rule List < Object > combinedRulesOutput = new ArrayList < Object > ( rules . size ( ) ) ; for ( Rule < RI , RO > rule : rules ) { // Validate the data and get the ru...
Processes the specified rule input with each rule and processes the result of all rules all at once with each result handler .
247
24
5,522
private void processResultHandlers ( RHI resultHandlerInput ) { for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( resultHandlerInput ) ; } }
Processes the specified result handler input with each result handler .
43
12
5,523
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 .
66
9
5,524
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 .
427
15
5,525
public static List < FacetQueryResult . Field > convert ( QueryResponse solrResponse , Map < String , String > alias ) { // Sanity check if ( solrResponse == null || solrResponse . getResponse ( ) == null || solrResponse . getResponse ( ) . get ( "facets" ) == null ) { return null ; } if ( alias == null ) { alias = new...
Convert a generic solrResponse into our FacetQueryResult .
459
14
5,526
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 ( solrFacet...
In order to process type = query facets with a nested type = range .
142
15
5,527
@ 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 .
117
12
5,528
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 .
79
16
5,529
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
392
10
5,530
@ Override 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 .
74
13
5,531
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 .
55
7
5,532
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 .
91
7
5,533
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 .
84
4
5,534
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 .
79
4
5,535
public synchronized static void install ( ) { if ( ! isInstalled ( ) ) { InputStream is = BMPCLocalLauncher . class . getResourceAsStream ( BMP_LOCAL_ZIP_RES ) ; try { // Unzip BrowserMob Proxy contained in the project "/resources" unzip ( is , BMPC_USER_DIR ) ; // Set executable permissions on the BrowserMob Proxy lan...
Install Local BrowserMob Proxy .
173
6
5,536
public synchronized static String installedVersion ( ) { BufferedReader versionReader = null ; try { versionReader = new BufferedReader ( new FileReader ( BMP_LOCAL_VERSION_FILE ) ) ; // Read version and verify it's there String version = versionReader . readLine ( ) ; if ( null == version ) throw new Exception ( ) ; r...
Installed version of Local BrowserMob Proxy
148
8
5,537
private synchronized static void delete ( File file ) { // Check if file is directory if ( file . isDirectory ( ) ) { // Get all files in the folder File [ ] files = file . listFiles ( ) ; // Delete each file in the folder for ( int i = 0 ; i < files . length ; ++ i ) { delete ( files [ i ] ) ; } // Delete the folder f...
Delete file recursively if needed
109
7
5,538
public List < LuceneToken > parse ( String fieldName , String text ) throws IOException { return readTokens ( analyzer . tokenStream ( fieldName , text ) ) ; }
Parses one line of text
38
7
5,539
@ Override public void handleResult ( RHI result ) { for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( result ) ; } }
Processes the specified result using all delegate result handlers .
40
11
5,540
public static Set < File > getPublishedDependencyLibs ( @ Nonnull final Task pTask , @ Nonnull final DependencyConfig pDepConfig ) { Set < File > result = new HashSet <> ( ) ; Configuration cfg = new ClasspathBuilder ( pTask . getProject ( ) ) . buildMainRuntimeConfiguration ( pDepConfig ) ; for ( ResolvedDependency de...
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 .
155
28
5,541
@ Override protected void processTrigger ( final Trigger trigger ) { // Get data providers matching the trigger final List < DataProvider < RI > > mappedDataProviders = triggersToDataProviders . get ( trigger ) ; if ( ( mappedDataProviders == null ) || mappedDataProviders . isEmpty ( ) ) { LOGGER . warn ( "No matching ...
Processes the specified trigger by finding all the mapped data providers and so on .
128
16
5,542
private void processDataProvider ( final DataProvider < RI > dataProvider ) { // Get rules matching the data provider final List < Rule < RI , RO > > mappedRules = dataProvidersToRules . get ( dataProvider ) ; if ( ( mappedRules == null ) || mappedRules . isEmpty ( ) ) { LOGGER . warn ( "No matching rule in mappable va...
Process the specified data provider by finding all the mapped rules and so on .
143
15
5,543
private void processRule ( final Rule < RI , RO > rule , final RI data ) { // Get result handlers matching the rule final List < ResultHandler < RO > > mappedResultHandlers = rulesToResultHandlers . get ( rule ) ; if ( ( mappedResultHandlers == null ) || mappedResultHandlers . isEmpty ( ) ) { LOGGER . warn ( "No matchi...
Processes the specified rule by finding all the mapped results handlers checking the rule and processing the rule result using all found result handlers .
152
26
5,544
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 .
53
9
5,545
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 .
50
12
5,546
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 ( ) ) + "=" + METAD...
Creates a virtual page title from a set of metadata key - value pairs .
124
16
5,547
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 .
870
12
5,548
public RuleContext < D > read ( final DataProvider < D > ... dataProviders ) { if ( dataProviders != null ) { Collections . addAll ( registeredDataProviders , dataProviders ) ; } return this ; }
Adds more data providers to the validator .
49
9
5,549
private void updateFromProperties ( ) { // Get value from all properties: use a new collection so that equals() returns false List < R > newValues = new ArrayList < R > ( ) ; for ( ReadableProperty < R > master : properties ) { newValues . add ( master . getValue ( ) ) ; } // Notify slaves setValue ( newValues ) ; }
Updates the current collection of values from the sub - properties and notifies the listeners .
81
18
5,550
private void dispose ( Collection < ? > elements ) { // Dispose all disposable elements for ( Object element : elements ) { if ( element instanceof Disposable ) { ( ( Disposable ) element ) . dispose ( ) ; } } // Clear collection dataProviders . clear ( ) ; }
Clears all elements from the specified collection .
62
9
5,551
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 ) ; // Slave initial values updateSlaves ( master . getValue ( )...
Initializes the bond .
76
5
5,552
private void updateSlaves ( MO masterOutputValue ) { // Transform value SI slaveInputValue = transformer . transform ( masterOutputValue ) ; // Notify slave(s) slave . setValue ( slaveInputValue ) ; }
Sets the value of the slaves according the value of the master .
47
14
5,553
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 .
118
16
5,554
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 .
65
9
5,555
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
45
14
5,556
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
39
15
5,557
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 .
62
22
5,558
private void unhookFromTrigger ( final T trigger ) { // Unhook from trigger final TriggerListener triggerAdapter = triggersToTriggerAdapters . get ( trigger ) ; trigger . removeTriggerListener ( triggerAdapter ) ; // Check if trigger was added several times if ( ! triggersToTriggerAdapters . containsKey ( trigger ) ) {...
De - registers the trigger listener .
91
7
5,559
private void unmapTriggerFromAllDataProviders ( final T trigger ) { if ( trigger != null ) { unhookFromTrigger ( trigger ) ; triggersToDataProviders . remove ( trigger ) ; } }
Disconnects the specified trigger from all data providers .
44
11
5,560
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 .
63
11
5,561
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 .
55
11
5,562
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 .
61
11
5,563
private void disposeTriggersAndDataProviders ( ) { for ( final Map . Entry < T , List < DP > > entry : triggersToDataProviders . entrySet ( ) ) { // Disconnect from trigger unhookFromTrigger ( entry . getKey ( ) ) ; // Dispose trigger itself final T trigger = entry . getKey ( ) ; if ( trigger instanceof Disposable ) { ...
Disposes all triggers and data providers that are mapped to each other .
186
14
5,564
private void disposeRulesAndResultHandlers ( ) { for ( final Map . Entry < R , List < RH > > entry : rulesToResultHandlers . entrySet ( ) ) { // Dispose rule final R rule = entry . getKey ( ) ; if ( rule instanceof Disposable ) { ( ( Disposable ) rule ) . dispose ( ) ; } // Dispose result handlers final List < RH > res...
Disposes all rules and result handlers that are mapped to each other .
165
14
5,565
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 .
63
15
5,566
private GeneralValidator < DPO , RI , RO , RHI > build ( ) { // Create validator GeneralValidator < DPO , RI , RO , RHI > validator = new GeneralValidator < DPO , RI , RO , RHI > ( ) ; // Add triggers for ( Trigger trigger : addedTriggers ) { validator . addTrigger ( trigger ) ; } // Add data providers for ( DataProvid...
Builds the validator .
272
6
5,567
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 .
66
16
5,568
public JsonObject newHar ( String initialPageRef , boolean captureHeaders , boolean captureContent , boolean captureBinaryContent ) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har" ) . build ( ) ) ; // Add form paramete...
Creates a new HAR attached to the proxy .
268
10
5,569
public void newPage ( String pageRef ) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har/pageRef" ) . build ( ) ) ; // Add form parameters to the request applyFormParamsToHttpRequest ( request , new BasicNameValuePair ( "...
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 .
215
30
5,570
public JsonObject har ( ) { try { // Request BMP to create a new HAR for this Proxy HttpGet request = new HttpGet ( requestURIBuilder ( ) . setPath ( proxyURIPath ( ) + "/har" ) . build ( ) ) ; // Execute request CloseableHttpResponse response = HTTPclient . execute ( request ) ; // Parse response into JSON JsonObject ...
Produces the HAR so far based on the traffic generated so far .
135
14
5,571
public static void harToFile ( JsonObject har , String destinationDir , String destinationFile ) { // Prepare HAR destination directory File harDestinationDir = new File ( destinationDir ) ; if ( ! harDestinationDir . exists ( ) ) harDestinationDir . mkdirs ( ) ; // Store HAR to disk PrintWriter harDestinationFileWrite...
Utility to store HAR to file .
214
8
5,572
protected void processResult ( RO result ) { for ( ResultHandler < RO > resultHandler : resultHandlers ) { resultHandler . handleResult ( result ) ; } }
Handles the specified result using all result handlers .
35
10
5,573
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 .
351
51
5,574
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 .
382
29
5,575
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 .
45
8
5,576
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 .
101
10
5,577
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" , GradleVer...
Build a little map with standard manifest attributes .
159
9
5,578
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 .
48
12
5,579
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 .
114
24
5,580
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 .
267
24
5,581
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 .
418
6
5,582
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 .
131
14
5,583
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
91
13
5,584
@ SuppressWarnings ( "unchecked" ) public < T > T getExtraPropertyValue ( @ Nonnull final ExtProp pExtraPropName ) { ExtraPropertiesExtension extraProps = project . getExtensions ( ) . getByType ( ExtraPropertiesExtension . class ) ; if ( extraProps . has ( pExtraPropName . getPropertyName ( ) ) ) { return ( T ) extraP...
Read the value of an extra property of the project .
142
11
5,585
@ Nonnull public Task getTask ( @ Nonnull final TaskNames pTaskName , @ Nonnull final DependencyConfig pDepConfig ) { return project . getTasks ( ) . getByName ( pTaskName . getName ( pDepConfig ) ) ; }
Convenience method for getting a specific task directly .
57
11
5,586
public void addBuildTimestampDeferred ( @ Nonnull final Task pTask , @ Nonnull final Attributes pAttributes ) { pTask . doFirst ( new Closure < Void > ( pTask ) { @ Override @ 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 .
85
26
5,587
public void inheritManifest ( @ Nonnull final Jar pTask , @ Nonnull final DependencyConfig pDepConfig ) { pTask . doFirst ( new Closure < Void > ( pTask ) { @ Override @ SuppressWarnings ( "MethodDoesntCallSuperMethod" ) public Void call ( ) { final Jar jarTask = ( Jar ) getTask ( TaskNames . jar , pDepConfig ) ; pTask...
Make the given Jar task inherit its manifest from the main thin Jar task . Also set the build timestamp .
134
21
5,588
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 .
47
13
5,589
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 .
69
8
5,590
private void notifyListenersIfUninhibited ( R oldValue , R newValue ) { if ( inhibited ) { inhibitCount ++ ; lastInhibitedValue = newValue ; } else { lastInhibitedValue = newValue ; // Just in case, even though not really necessary lastNonInhibitedValue = newValue ; doNotifyListeners ( oldValue , newValue ) ; } }
Notifies the listeners that the property value has changed if the property is not inhibited .
81
17
5,591
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 ) ; } n...
Notifies the listeners that the property value has changed unconditionally .
87
13
5,592
private void validateTimes ( int idx , SubPicture subPic , SubPicture subPicNext , SubPicture subPicPrev ) { long startTime = subPic . getStartTime ( ) ; long endTime = subPic . getEndTime ( ) ; final long delay = 5000 * 90 ; // default delay for missing end time (5 // seconds) idx += 1 ; // only used for display // ge...
Check start and end time fix overlaps etc .
460
10
5,593
private List < Integer > getSubPicturesToBeExported ( ) { List < Integer > subPicturesToBeExported = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < subPictures . length ; i ++ ) { SubPicture subPicture = subPictures [ i ] ; if ( ! subPicture . isExcluded ( ) && ( ! configuration . isExportForced ( ) || subPictur...
Return indexes of subpictures to be exported .
127
10
5,594
private void determineFramePal ( int index ) { if ( ( inMode != InputMode . VOBSUB && inMode != InputMode . SUPIFO ) || configuration . getPaletteMode ( ) != PaletteMode . KEEP_EXISTING ) { // get the primary color from the source palette int rgbSrc [ ] = subtitleStream . getPalette ( ) . getRGB ( subtitleStream . getP...
Create the frame individual 4 - color palette for VobSub mode .
522
14
5,595
@ SuppressWarnings ( "unchecked" ) public < TO > ChainedTransformer < I , TO > chain ( Transformer < O , TO > transformer ) { if ( transformer != null ) { transformers . add ( transformer ) ; } return ( ChainedTransformer < I , TO > ) this ; }
Adds the specified transformer to the chain .
68
8
5,596
protected void processResult ( RHI aggregatedResult ) { // Process the result with all result handlers for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( aggregatedResult ) ; } }
Handles the specified aggregated result using all result handlers .
49
12
5,597
@ CheckForNull public static String getFirstIdent ( @ Nonnull final DetailAST pAst ) { String result = null ; DetailAST ast = pAst . findFirstToken ( TokenTypes . IDENT ) ; if ( ast != null ) { result = ast . getText ( ) ; } return result ; }
Determine the text of the first direct IDENT child node .
65
14
5,598
@ CheckForNull public static String getFullIdent ( @ Nonnull final DetailAST pAst ) { String result = null ; DetailAST ast = checkTokens ( pAst . getFirstChild ( ) , TokenTypes . DOT , TokenTypes . IDENT ) ; if ( ast != null ) { StringBuilder sb = new StringBuilder ( ) ; if ( getFullIdentInternal ( ast , sb ) ) { resul...
Determine the full identifier of the current element on the AST . The identifier is built from DOT and IDENT elements found directly below the specified element . Other elements encountered are ignored .
102
37
5,599
public static boolean containsString ( @ Nullable final Iterable < String > pIterable , @ Nullable final String pSearched , final boolean pCaseSensitive ) { boolean result = false ; if ( pSearched != null && pIterable != null ) { for ( String s : pIterable ) { if ( stringEquals ( pSearched , s , pCaseSensitive ) ) { re...
Search for a String in a collection .
101
8