idx
int64 0
165k
| question
stringlengths 73
5.81k
| target
stringlengths 5
918
|
|---|---|---|
5,600
|
private void validateTimes ( int idx , SubPicture subPic , SubPicture subPicNext , SubPicture subPicPrev ) { long startTime = subPic . getStartTime ( ) ; long endTime = subPic . getEndTime ( ) ; final long delay = 5000 * 90 ; idx += 1 ; long lastEndTime = subPicPrev != null ? subPicPrev . getEndTime ( ) : - 1 ; if ( startTime < lastEndTime ) { startTime = lastEndTime ; } long nextStartTime = subPicNext != null ? subPicNext . getStartTime ( ) : 0 ; if ( nextStartTime == 0 ) { if ( endTime > startTime ) { nextStartTime = endTime ; } else { nextStartTime = startTime + delay ; } } if ( endTime <= startTime ) { endTime = startTime + delay ; if ( endTime > nextStartTime ) { endTime = nextStartTime ; } } else if ( endTime > nextStartTime ) { endTime = nextStartTime ; } int minTimePTS = configuration . getMinTimePTS ( ) ; if ( endTime - startTime < minTimePTS ) { if ( configuration . getFixShortFrames ( ) ) { endTime = startTime + minTimePTS ; if ( endTime > nextStartTime ) { endTime = nextStartTime ; } } } if ( subPic . getStartTime ( ) != startTime ) { subPic . setStartTime ( SubtitleUtils . syncTimePTS ( startTime , configuration . getFpsTrg ( ) , configuration . getFpsTrg ( ) ) ) ; } if ( subPic . getEndTime ( ) != endTime ) { subPic . setEndTime ( SubtitleUtils . syncTimePTS ( endTime , configuration . getFpsTrg ( ) , configuration . getFpsTrg ( ) ) ) ; } }
|
Check start and end time fix overlaps etc .
|
5,601
|
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 ( ) || subPicture . isForced ( ) ) ) { subPicturesToBeExported . add ( i ) ; } } return subPicturesToBeExported ; }
|
Return indexes of subpictures to be exported .
|
5,602
|
private void determineFramePal ( int index ) { if ( ( inMode != InputMode . VOBSUB && inMode != InputMode . SUPIFO ) || configuration . getPaletteMode ( ) != PaletteMode . KEEP_EXISTING ) { int rgbSrc [ ] = subtitleStream . getPalette ( ) . getRGB ( subtitleStream . getPrimaryColorIndex ( ) ) ; Palette trgPallete = currentDVDPalette ; int minDistance = 0xffffff ; int colIdx = 0 ; for ( int idx = 1 ; idx < trgPallete . getSize ( ) ; idx += 2 ) { int rgb [ ] = trgPallete . getRGB ( idx ) ; int rd = rgbSrc [ 0 ] - rgb [ 0 ] ; int gd = rgbSrc [ 1 ] - rgb [ 1 ] ; int bd = rgbSrc [ 2 ] - rgb [ 2 ] ; int distance = rd * rd + gd * gd + bd * bd ; if ( distance < minDistance ) { colIdx = idx ; minDistance = distance ; if ( minDistance == 0 ) { break ; } } if ( idx == 1 ) { idx -- ; } } int palFrame [ ] = new int [ 4 ] ; palFrame [ 0 ] = 0 ; palFrame [ 1 ] = colIdx ; if ( colIdx == 1 ) { palFrame [ 2 ] = colIdx + 2 ; } else { palFrame [ 2 ] = colIdx + 1 ; } palFrame [ 3 ] = 0 ; subVobTrg . setAlpha ( DEFAULT_ALPHA ) ; subVobTrg . setPal ( palFrame ) ; trgPal = SupDvdUtil . decodePalette ( subVobTrg , trgPallete ) ; } }
|
Create the frame individual 4 - color palette for VobSub mode .
|
5,603
|
@ 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 .
|
5,604
|
protected void processResult ( RHI aggregatedResult ) { for ( ResultHandler < RHI > resultHandler : resultHandlers ) { resultHandler . handleResult ( aggregatedResult ) ; } }
|
Handles the specified aggregated result using all result handlers .
|
5,605
|
public static String getFirstIdent ( 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 .
|
5,606
|
public static String getFullIdent ( 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 ) ) { result = sb . toString ( ) ; } } return result ; }
|
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 .
|
5,607
|
public static boolean containsString ( final Iterable < String > pIterable , final String pSearched , final boolean pCaseSensitive ) { boolean result = false ; if ( pSearched != null && pIterable != null ) { for ( String s : pIterable ) { if ( stringEquals ( pSearched , s , pCaseSensitive ) ) { result = true ; break ; } } } return result ; }
|
Search for a String in a collection .
|
5,608
|
public static boolean stringEquals ( final String pStr1 , final String pStr2 , final boolean pCaseSensitive ) { boolean result = false ; if ( pStr1 == null && pStr2 == null ) { result = true ; } else if ( pStr1 != null ) { if ( pCaseSensitive ) { result = pStr1 . equals ( pStr2 ) ; } else { result = pStr1 . equalsIgnoreCase ( pStr2 ) ; } } return result ; }
|
Determine the equality of two Strings optionally ignoring case .
|
5,609
|
public static DetailAST findLeftMostTokenInLine ( final DetailAST pAst ) { return findLeftMostTokenInLineInternal ( pAst , pAst . getLineNo ( ) , pAst . getColumnNo ( ) ) ; }
|
Find the left - most token in the given AST . The left - most token is the token with the smallest column number . Only tokens which are located on the same line as the given AST are considered .
|
5,610
|
public void setToolTipText ( String text ) { this . toolTipText = text ; if ( toolTipDialog != null ) { toolTipDialog . setText ( text ) ; } }
|
Sets the text for the tooltip to be used on this decoration .
|
5,611
|
private void updateToolTipDialogVisibility ( ) { boolean shouldBeVisible = isOverDecorationPainter ( ) || isOverToolTipDialog ( ) ; if ( shouldBeVisible ) { createToolTipDialogIfNeeded ( ) ; } if ( ( toolTipDialog != null ) && ( toolTipDialog . isVisible ( ) != shouldBeVisible ) ) { toolTipDialog . setVisible ( shouldBeVisible ) ; } }
|
Updates the visibility of the tooltip dialog according to the mouse pointer location the visibility of the decoration painter and the bounds of the decoration painter .
|
5,612
|
public void send ( Event event ) throws MetricsException { HttpPost request = new HttpPost ( MetricsUtils . GA_ENDPOINT_URL ) ; request . setEntity ( MetricsUtils . buildPostBody ( event , analyticsId , random ) ) ; try { client . execute ( request , RESPONSE_HANDLER ) ; } catch ( IOException e ) { throw new MetricsCommunicationException ( "Problem sending request to server" , e ) ; } }
|
Translates an encapsulated event into a request to the Google Analytics API and sends the resulting request .
|
5,613
|
public synchronized boolean isRunning ( ) { if ( null == process ) return false ; try { process . exitValue ( ) ; return false ; } catch ( IllegalThreadStateException itse ) { return true ; } }
|
Check if Local BrowserMob Proxy is running .
|
5,614
|
private static String convertToRomaji ( String katakana ) throws EasyJaSubException { try { return Kurikosu . convertKatakanaToRomaji ( katakana ) ; } catch ( EasyJaSubException ex ) { try { return LuceneUtil . katakanaToRomaji ( katakana ) ; } catch ( Throwable luceneEx ) { throw ex ; } } }
|
Convert katakana to romaji with Lucene converter if Kurikosu throws errors
|
5,615
|
public DataProviderContext on ( final Trigger ... triggers ) { if ( triggers != null ) { Collections . addAll ( registeredTriggers , triggers ) ; } return this ; }
|
Adds more triggers to the validator .
|
5,616
|
public < D > RuleContext < D > read ( final DataProvider < D > ... dataProviders ) { final List < DataProvider < D > > registeredDataProviders = new ArrayList < DataProvider < D > > ( ) ; if ( dataProviders != null ) { Collections . addAll ( registeredDataProviders , dataProviders ) ; } return new RuleContext < D > ( registeredTriggers , registeredDataProviders ) ; }
|
Adds the first data providers to the validator .
|
5,617
|
public FileCollection buildClassPath ( final DependencyConfig pDepConfig , final String pCsVersionOverride , final boolean pIsTestRun , final SourceSet pSourceSet1 , final SourceSet ... pOtherSourceSets ) { FileCollection cp = getClassesDirs ( pSourceSet1 , pDepConfig ) . plus ( project . files ( pSourceSet1 . getOutput ( ) . getResourcesDir ( ) ) ) ; if ( pOtherSourceSets != null && pOtherSourceSets . length > 0 ) { for ( final SourceSet sourceSet : pOtherSourceSets ) { cp = cp . plus ( getClassesDirs ( sourceSet , pDepConfig ) ) . plus ( project . files ( sourceSet . getOutput ( ) . getResourcesDir ( ) ) ) ; } } cp = cp . plus ( project . files ( calculateDependencies ( pDepConfig , pCsVersionOverride , getConfigName ( pSourceSet1 , pIsTestRun ) ) ) ) ; if ( pOtherSourceSets != null && pOtherSourceSets . length > 0 ) { for ( final SourceSet sourceSet : pOtherSourceSets ) { cp = cp . plus ( project . files ( calculateDependencies ( pDepConfig , pCsVersionOverride , getConfigName ( sourceSet , pIsTestRun ) ) ) ) ; } } return cp ; }
|
Run the classpath builder to produce a classpath for compilation running the Javadoc generation or running unit tests .
|
5,618
|
public static TriggerContext on ( Trigger trigger ) { List < Trigger > addedTriggers = new ArrayList < Trigger > ( ) ; if ( trigger != null ) { addedTriggers . add ( trigger ) ; } return new TriggerContext ( addedTriggers ) ; }
|
Adds the specified trigger to the validator under construction .
|
5,619
|
public static String getFileName ( final ConfigurationSourceKey source ) { if ( source . getType ( ) != ConfigurationSourceKey . Type . FILE ) throw new AssertionError ( "Can only load configuration sources with type " + ConfigurationSourceKey . Type . FILE ) ; return source . getName ( ) + '.' + source . getFormat ( ) . getExtension ( ) ; }
|
Returns the file name for the given source key .
|
5,620
|
public void setExtraFields ( Collection < String > fields ) { extraFields = new HashSet < String > ( ) ; if ( fields != null ) { extraFields . addAll ( fields ) ; } }
|
Sets the extra fields to request for the retrieved graph objects .
|
5,621
|
public Map < String , String > data ( ) { try { return event ( ) . get ( ) ; } catch ( InterruptedException e ) { throw new IllegalStateException ( e ) ; } }
|
A shortcut to get the result of the completed query event .
|
5,622
|
public void onRead ( Input < ByteBuffer > event ) throws InterruptedException { for ( IOSubchannel channel : event . channels ( IOSubchannel . class ) ) { ManagedBuffer < ByteBuffer > out = channel . byteBufferPool ( ) . acquire ( ) ; out . backingBuffer ( ) . put ( event . buffer ( ) . backingBuffer ( ) ) ; channel . respond ( Output . fromSink ( out , event . isEndOfRecord ( ) ) ) ; } }
|
Handle input data .
|
5,623
|
public void onOutput ( Output < ByteBuffer > event , TcpChannelImpl channel ) throws InterruptedException { if ( channels . contains ( channel ) ) { channel . write ( event ) ; } }
|
Writes the data passed in the event .
|
5,624
|
public String replace ( CharSequence text ) { TextBuffer tb = wrap ( new StringBuilder ( text . length ( ) ) ) ; replace ( pattern . matcher ( text ) , substitution , tb ) ; return tb . toString ( ) ; }
|
Takes all instances in text of the Pattern this was constructed with and replaces them with substitution .
|
5,625
|
public int replace ( CharSequence text , StringBuilder sb ) { return replace ( pattern . matcher ( text ) , substitution , wrap ( sb ) ) ; }
|
Takes all occurrences of the pattern this was constructed with in text and replaces them with the substitution . Appends the replaced text into sb .
|
5,626
|
@ Handler ( priority = 1000 ) public void onProtocolSwitchAccepted ( ProtocolSwitchAccepted event , IOSubchannel channel ) { event . requestEvent ( ) . associated ( Selection . class ) . ifPresent ( selection -> channel . setAssociated ( Selection . class , selection ) ) ; }
|
Handles a procotol switch by associating the language selection with the channel .
|
5,627
|
public static Locale associatedLocale ( Associator assoc ) { return assoc . associated ( Selection . class ) . map ( sel -> sel . get ( ) [ 0 ] ) . orElse ( Locale . getDefault ( ) ) ; }
|
Convenience method to retrieve a locale from an associator .
|
5,628
|
private DataContainer fetch ( String tableAlias , IndexBooleanExpression condition , Map < String , String > tableAliases ) { String tableName = tableAliases . get ( tableAlias ) ; Set < String > ids = getIdsFromIndex ( tableName , tableAlias , condition ) ; return fetchContainer ( tableName , tableAlias , ids ) ; }
|
planner should guarantee that .
|
5,629
|
private static Set < Key > conditionToKeys ( int keyLength , Map < String , Set < Object > > condition ) { return crossProduct ( new ArrayList < > ( condition . values ( ) ) ) . stream ( ) . map ( v -> Keys . key ( keyLength , v . toArray ( ) ) ) . collect ( Collectors . toSet ( ) ) ; }
|
Set of objects is used for OR conditions . Otherwise set contains only one value .
|
5,630
|
public Value getValue ( final Environment in ) { log . debug ( "looking up value for " + name + " in " + in ) ; return attributeValue . get ( in ) ; }
|
Returns the value of the attribute in the given environment .
|
5,631
|
public KeyValueStoreUpdate update ( String key , String value ) { actions . add ( new Update ( key , value ) ) ; return this ; }
|
Adds a new update action to the event .
|
5,632
|
public KeyValueStoreUpdate storeAs ( String value , String ... segments ) { actions . add ( new Update ( "/" + String . join ( "/" , segments ) , value ) ) ; return this ; }
|
Adds a new update action to the event that stores the given value on the path formed by the path segments .
|
5,633
|
public KeyValueStoreUpdate clearAll ( String ... segments ) { actions . add ( new Deletion ( "/" + String . join ( "/" , segments ) ) ) ; return this ; }
|
Adds a new deletion action that clears all keys with the given path prefix .
|
5,634
|
public void set ( Value value , Environment in ) { values . put ( in . expandedStringForm ( ) , value ) ; }
|
Sets the value in a given environment .
|
5,635
|
@ SuppressWarnings ( { "PMD.DataflowAnomalyAnalysis" } ) static ComponentVertex getComponentProxy ( ComponentType component , Channel componentChannel ) { ComponentProxy componentProxy = null ; try { Field field = getManagerField ( component . getClass ( ) ) ; synchronized ( component ) { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; componentProxy = ( ComponentProxy ) field . get ( component ) ; if ( componentProxy == null ) { componentProxy = new ComponentProxy ( field , component , componentChannel ) ; } field . setAccessible ( false ) ; } else { componentProxy = ( ComponentProxy ) field . get ( component ) ; if ( componentProxy == null ) { componentProxy = new ComponentProxy ( field , component , componentChannel ) ; } } } } catch ( SecurityException | IllegalAccessException e ) { throw ( RuntimeException ) ( new IllegalArgumentException ( "Cannot access component's manager attribute" ) ) . initCause ( e ) ; } return componentProxy ; }
|
Return the component node for a component that is represented by a proxy in the tree .
|
5,636
|
public final < T extends GraphObject > T getGraphObjectAs ( Class < T > graphObjectClass ) { if ( graphObject == null ) { return null ; } if ( graphObjectClass == null ) { throw new NullPointerException ( "Must pass in a valid interface that extends GraphObject" ) ; } return graphObject . cast ( graphObjectClass ) ; }
|
The single graph object returned for this request if any cast into a particular type of GraphObject .
|
5,637
|
public final < T extends GraphObject > GraphObjectList < T > getGraphObjectListAs ( Class < T > graphObjectClass ) { if ( graphObjectList == null ) { return null ; } return graphObjectList . castToListOf ( graphObjectClass ) ; }
|
The list of graph objects returned for this request if any cast into a particular type of GraphObject .
|
5,638
|
public Request getRequestForPagedResults ( PagingDirection direction ) { String link = null ; if ( graphObject != null ) { PagedResults pagedResults = graphObject . cast ( PagedResults . class ) ; PagingInfo pagingInfo = pagedResults . getPaging ( ) ; if ( pagingInfo != null ) { if ( direction == PagingDirection . NEXT ) { link = pagingInfo . getNext ( ) ; } else { link = pagingInfo . getPrevious ( ) ; } } } if ( Utility . isNullOrEmpty ( link ) ) { return null ; } if ( link != null && link . equals ( request . getUrlForSingleRequest ( ) ) ) { return null ; } Request pagingRequest ; try { pagingRequest = new Request ( request . getSession ( ) , new URL ( link ) ) ; } catch ( MalformedURLException e ) { return null ; } return pagingRequest ; }
|
If a Response contains results that contain paging information returns a new Request that will retrieve the next page of results in whichever direction is desired . If no paging information is available returns null .
|
5,639
|
protected Configuration freemarkerConfig ( ) { if ( fmConfig == null ) { fmConfig = new Configuration ( Configuration . VERSION_2_3_26 ) ; fmConfig . setClassLoaderForTemplateLoading ( contentLoader , contentPath ) ; fmConfig . setDefaultEncoding ( "utf-8" ) ; fmConfig . setTemplateExceptionHandler ( TemplateExceptionHandler . RETHROW_HANDLER ) ; fmConfig . setLogTemplateExceptions ( false ) ; } return fmConfig ; }
|
Creates the configuration for freemarker template processing .
|
5,640
|
protected Map < String , Object > fmSessionModel ( Optional < Session > session ) { @ SuppressWarnings ( "PMD.UseConcurrentHashMap" ) final Map < String , Object > model = new HashMap < > ( ) ; Locale locale = session . map ( sess -> sess . locale ( ) ) . orElse ( Locale . getDefault ( ) ) ; model . put ( "locale" , locale ) ; final ResourceBundle resourceBundle = resourceBundle ( locale ) ; model . put ( "resourceBundle" , resourceBundle ) ; model . put ( "_" , new TemplateMethodModelEx ( ) { @ SuppressWarnings ( "PMD.EmptyCatchBlock" ) public Object exec ( @ SuppressWarnings ( "rawtypes" ) List arguments ) throws TemplateModelException { @ SuppressWarnings ( "unchecked" ) List < TemplateModel > args = ( List < TemplateModel > ) arguments ; if ( ! ( args . get ( 0 ) instanceof SimpleScalar ) ) { throw new TemplateModelException ( "Not a string." ) ; } String key = ( ( SimpleScalar ) args . get ( 0 ) ) . getAsString ( ) ; try { return resourceBundle . getString ( key ) ; } catch ( MissingResourceException e ) { } return key ; } } ) ; return model ; }
|
Build a freemarker model holding the information associated with the session .
|
5,641
|
protected ResourceBundle resourceBundle ( Locale locale ) { return ResourceBundle . getBundle ( contentPath . replace ( '/' , '.' ) + ".l10n" , locale , contentLoader , ResourceBundle . Control . getNoFallbackControl ( ResourceBundle . Control . FORMAT_DEFAULT ) ) ; }
|
Provides a resource bundle for localization . The default implementation looks up a bundle using the package name plus l10n as base name .
|
5,642
|
private void removeBuffer ( W buffer ) { createdBufs . decrementAndGet ( ) ; if ( bufferMonitor . remove ( buffer ) == null ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . log ( Level . WARNING , "Attempt to remove unknown buffer from pool." , new Throwable ( ) ) ; } else { logger . warning ( "Attempt to remove unknown buffer from pool." ) ; } } }
|
Removes the buffer from the pool .
|
5,643
|
@ SuppressWarnings ( "PMD.GuardLogStatement" ) public W acquire ( ) throws InterruptedException { Optional . ofNullable ( idleTimer . getAndSet ( null ) ) . ifPresent ( timer -> timer . cancel ( ) ) ; if ( createdBufs . get ( ) < maximumBufs ) { W buffer = queue . poll ( ) ; if ( buffer != null ) { buffer . lockBuffer ( ) ; return buffer ; } return createBuffer ( ) ; } if ( logger . isLoggable ( Level . FINE ) ) { W buffer = queue . poll ( acquireWarningLimit , TimeUnit . MILLISECONDS ) ; if ( buffer != null ) { buffer . lockBuffer ( ) ; return buffer ; } logger . log ( Level . FINE , new Throwable ( ) , ( ) -> Thread . currentThread ( ) . getName ( ) + " waiting > " + acquireWarningLimit + "ms for buffer, while executing:" ) ; } W buffer = queue . take ( ) ; buffer . lockBuffer ( ) ; return buffer ; }
|
Acquires a managed buffer from the pool . If the pool is empty waits for a buffer to become available . The acquired buffer has a lock count of one .
|
5,644
|
public void recollect ( W buffer ) { if ( queue . size ( ) < preservedBufs ) { long effectiveDrainDelay = drainDelay > 0 ? drainDelay : defaultDrainDelay ; if ( effectiveDrainDelay > 0 ) { buffer . clear ( ) ; queue . add ( buffer ) ; Timer old = idleTimer . getAndSet ( Components . schedule ( this :: drain , Duration . ofMillis ( effectiveDrainDelay ) ) ) ; if ( old != null ) { old . cancel ( ) ; } return ; } } removeBuffer ( buffer ) ; }
|
Re - adds the buffer to the pool . The buffer is cleared .
|
5,645
|
public Value getIncludedValue ( Environment in ) { return ConfigurationManager . INSTANCE . getConfiguration ( configurationName , in ) . getAttribute ( attributeName ) ; }
|
Resolves included value dynamically from the linked config in the specified environment .
|
5,646
|
public ConfigurationSourceKey getConfigName ( ) { return new ConfigurationSourceKey ( ConfigurationSourceKey . Type . FILE , ConfigurationSourceKey . Format . JSON , configurationName ) ; }
|
Get configuration name of the linked config
|
5,647
|
Configuration copyWithIdentifier ( String identifier ) { return new Configuration ( details . builder ( ) . identifier ( identifier ) . build ( ) , new HashMap < > ( config ) ) ; }
|
Creates a configuration with the same content as this instance but with the specified identifier .
|
5,648
|
void write ( File f ) throws FileNotFoundException , IOException { try ( ObjectOutputStream os = new ObjectOutputStream ( new FileOutputStream ( f ) ) ) { os . writeObject ( this ) ; } }
|
Writes the configuration to file .
|
5,649
|
public void fireUpdateEvent ( final long timestamp ) { synchronized ( listeners ) { for ( final ConfigurationSourceListener listener : listeners ) { try { log . debug ( "Calling configurationSourceUpdated on " + listener ) ; listener . configurationSourceUpdated ( this ) ; } catch ( final Exception e ) { log . error ( "Error in notifying configuration source listener:" + listener , e ) ; } } } lastChangeTimestamp = timestamp ; }
|
Called by the ConfigurationSourceRegistry if a change in the underlying source is detected .
|
5,650
|
InventoryEntry remove ( String key ) { InventoryEntry ret = configs . remove ( key ) ; if ( ret != null ) { ret . getPath ( ) . delete ( ) ; } return ret ; }
|
Removes the entry with the specified key .
|
5,651
|
List < Configuration > removeMismatching ( ) { List < InventoryEntry > mismatching = configs . values ( ) . stream ( ) . filter ( v -> ( v . getConfiguration ( ) . isPresent ( ) && ! v . getIdentifier ( ) . equals ( v . getConfiguration ( ) . get ( ) . getDetails ( ) . getKey ( ) ) ) ) . collect ( Collectors . toList ( ) ) ; mismatching . forEach ( v -> configs . remove ( v . getIdentifier ( ) ) ) ; return mismatching . stream ( ) . map ( v -> v . getConfiguration ( ) . get ( ) ) . collect ( Collectors . toList ( ) ) ; }
|
Removes configurations with mismatching identifiers .
|
5,652
|
List < File > removeUnreadable ( ) { List < InventoryEntry > unreadable = configs . values ( ) . stream ( ) . filter ( v -> ! v . getConfiguration ( ) . isPresent ( ) ) . collect ( Collectors . toList ( ) ) ; unreadable . forEach ( v -> configs . remove ( v . getIdentifier ( ) ) ) ; return unreadable . stream ( ) . map ( v -> v . getPath ( ) ) . collect ( Collectors . toList ( ) ) ; }
|
Removes entries whose configurations are unreadable from the inventory .
|
5,653
|
@ RequestHandler ( patterns = "/form,/form/**" ) public void onGet ( Request . In . Get event , IOSubchannel channel ) throws ParseException { ResponseCreationSupport . sendStaticContent ( event , channel , path -> FormProcessor . class . getResource ( ResourcePattern . removeSegments ( path , 1 ) ) , null ) ; }
|
Handle a GET request .
|
5,654
|
@ RequestHandler ( patterns = "/form,/form/**" ) public void onPost ( Request . In . Post event , IOSubchannel channel ) { FormContext ctx = channel . associated ( this , FormContext :: new ) ; ctx . request = event . httpRequest ( ) ; ctx . session = event . associated ( Session . class ) . get ( ) ; event . setResult ( true ) ; event . stop ( ) ; }
|
Handle a POST request .
|
5,655
|
public void onInput ( Input < ByteBuffer > event , IOSubchannel channel ) throws InterruptedException , UnsupportedEncodingException { Optional < FormContext > ctx = channel . associated ( this , FormContext . class ) ; if ( ! ctx . isPresent ( ) ) { return ; } ctx . get ( ) . fieldDecoder . addData ( event . data ( ) ) ; if ( ! event . isEndOfRecord ( ) ) { return ; } long invocations = ( Long ) ctx . get ( ) . session . computeIfAbsent ( "invocations" , key -> { return 0L ; } ) ; ctx . get ( ) . session . put ( "invocations" , invocations + 1 ) ; HttpResponse response = ctx . get ( ) . request . response ( ) . get ( ) ; response . setStatus ( HttpStatus . OK ) ; response . setHasPayload ( true ) ; response . setField ( HttpField . CONTENT_TYPE , MediaType . builder ( ) . setType ( "text" , "plain" ) . setParameter ( "charset" , "utf-8" ) . build ( ) ) ; String data = "First name: " + ctx . get ( ) . fieldDecoder . fields ( ) . get ( "firstname" ) + "\r\n" + "Last name: " + ctx . get ( ) . fieldDecoder . fields ( ) . get ( "lastname" ) + "\r\n" + "Previous invocations: " + invocations ; channel . respond ( new Response ( response ) ) ; ManagedBuffer < ByteBuffer > out = channel . byteBufferPool ( ) . acquire ( ) ; out . backingBuffer ( ) . put ( data . getBytes ( "utf-8" ) ) ; channel . respond ( Output . fromSink ( out , true ) ) ; }
|
Hanlde input .
|
5,656
|
@ Handler ( channels = NetworkChannel . class ) @ SuppressWarnings ( "PMD.DataflowAnomalyAnalysis" ) public void onConnected ( Connected event , TcpChannel netConnChannel ) throws InterruptedException , IOException { WebAppMsgChannel [ ] appChannel = { null } ; synchronized ( connecting ) { connecting . computeIfPresent ( event . remoteAddress ( ) , ( key , set ) -> { Iterator < WebAppMsgChannel > iter = set . iterator ( ) ; appChannel [ 0 ] = iter . next ( ) ; iter . remove ( ) ; return set . isEmpty ( ) ? null : set ; } ) ; } if ( appChannel [ 0 ] != null ) { appChannel [ 0 ] . connected ( netConnChannel ) ; } }
|
Called when the network connection is established . Triggers the frther processing of the initial request .
|
5,657
|
@ Handler ( channels = NetworkChannel . class ) public void onInput ( Input < ByteBuffer > event , TcpChannel netConnChannel ) throws InterruptedException , ProtocolException { Optional < WebAppMsgChannel > appChannel = netConnChannel . associated ( WebAppMsgChannel . class ) ; if ( appChannel . isPresent ( ) ) { appChannel . get ( ) . handleNetInput ( event , netConnChannel ) ; } }
|
Processes any input from the network layer .
|
5,658
|
@ Handler ( channels = NetworkChannel . class ) public void onClosed ( Closed event , TcpChannel netConnChannel ) { netConnChannel . associated ( WebAppMsgChannel . class ) . ifPresent ( appChannel -> appChannel . handleClosed ( event ) ) ; pooled . remove ( netConnChannel . remoteAddress ( ) , netConnChannel ) ; }
|
Called when the network connection is closed .
|
5,659
|
Map < String , Object > bindStrutsContext ( Object action ) { Map < String , Object > variables = new HashMap < String , Object > ( ) ; variables . put ( ACTION_VARIABLE_NAME , action ) ; if ( action instanceof ActionSupport ) { ActionSupport actSupport = ( ActionSupport ) action ; Map < String , List < String > > fieldErrors = actSupport . getFieldErrors ( ) ; variables . put ( FIELD_ERRORS_NAME , fieldErrors ) ; } return variables ; }
|
Binding Struts2 action and context and field - errors list binding field .
|
5,660
|
public static synchronized void sdkInitialize ( Context context ) { if ( sdkInitialized == true ) { return ; } BoltsMeasurementEventListener . getInstance ( context . getApplicationContext ( ) ) ; sdkInitialized = true ; }
|
Initialize SDK This function will be called once in the application it is tried to be called as early as possible ; This is the place to register broadcast listeners .
|
5,661
|
public static Executor getExecutor ( ) { synchronized ( LOCK ) { if ( Settings . executor == null ) { Executor executor = getAsyncTaskExecutor ( ) ; if ( executor == null ) { executor = new ThreadPoolExecutor ( DEFAULT_CORE_POOL_SIZE , DEFAULT_MAXIMUM_POOL_SIZE , DEFAULT_KEEP_ALIVE , TimeUnit . SECONDS , DEFAULT_WORK_QUEUE , DEFAULT_THREAD_FACTORY ) ; } Settings . executor = executor ; } } return Settings . executor ; }
|
Returns the Executor used by the SDK for non - AsyncTask background work .
|
5,662
|
public static void setExecutor ( Executor executor ) { Validate . notNull ( executor , "executor" ) ; synchronized ( LOCK ) { Settings . executor = executor ; } }
|
Sets the Executor used by the SDK for non - AsyncTask background work .
|
5,663
|
public static String getAttributionId ( ContentResolver contentResolver ) { try { String [ ] projection = { ATTRIBUTION_ID_COLUMN_NAME } ; Cursor c = contentResolver . query ( ATTRIBUTION_ID_CONTENT_URI , projection , null , null , null ) ; if ( c == null || ! c . moveToFirst ( ) ) { return null ; } String attributionId = c . getString ( c . getColumnIndex ( ATTRIBUTION_ID_COLUMN_NAME ) ) ; c . close ( ) ; return attributionId ; } catch ( Exception e ) { Log . d ( TAG , "Caught unexpected exception in getAttributionId(): " + e . toString ( ) ) ; return null ; } }
|
Acquire the current attribution id from the facebook app .
|
5,664
|
public static boolean getLimitEventAndDataUsage ( Context context ) { SharedPreferences preferences = context . getSharedPreferences ( APP_EVENT_PREFERENCES , Context . MODE_PRIVATE ) ; return preferences . getBoolean ( "limitEventUsage" , false ) ; }
|
Gets whether data such as that generated through AppEventsLogger and sent to Facebook should be restricted from being used for purposes other than analytics and conversions such as for targeting ads to this user . Defaults to false . This value is stored on the device and persists across app launches .
|
5,665
|
public static void setLimitEventAndDataUsage ( Context context , boolean limitEventUsage ) { SharedPreferences preferences = context . getSharedPreferences ( APP_EVENT_PREFERENCES , Context . MODE_PRIVATE ) ; SharedPreferences . Editor editor = preferences . edit ( ) ; editor . putBoolean ( "limitEventUsage" , limitEventUsage ) ; editor . commit ( ) ; }
|
Sets whether data such as that generated through AppEventsLogger and sent to Facebook should be restricted from being used for purposes other than analytics and conversions such as for targeting ads to this user . Defaults to false . This value is stored on the device and persists across app launches . Changes to this setting will apply to app events currently queued to be flushed .
|
5,666
|
public void show ( ) { if ( mAnchorViewRef . get ( ) != null ) { mPopupContent = new PopupContentView ( mContext ) ; TextView body = ( TextView ) mPopupContent . findViewById ( R . id . com_facebook_tooltip_bubble_view_text_body ) ; body . setText ( mText ) ; if ( mStyle == Style . BLUE ) { mPopupContent . bodyFrame . setBackgroundResource ( R . drawable . com_facebook_tooltip_blue_background ) ; mPopupContent . bottomArrow . setImageResource ( R . drawable . com_facebook_tooltip_blue_bottomnub ) ; mPopupContent . topArrow . setImageResource ( R . drawable . com_facebook_tooltip_blue_topnub ) ; mPopupContent . xOut . setImageResource ( R . drawable . com_facebook_tooltip_blue_xout ) ; } else { mPopupContent . bodyFrame . setBackgroundResource ( R . drawable . com_facebook_tooltip_black_background ) ; mPopupContent . bottomArrow . setImageResource ( R . drawable . com_facebook_tooltip_black_bottomnub ) ; mPopupContent . topArrow . setImageResource ( R . drawable . com_facebook_tooltip_black_topnub ) ; mPopupContent . xOut . setImageResource ( R . drawable . com_facebook_tooltip_black_xout ) ; } final Window window = ( ( Activity ) mContext ) . getWindow ( ) ; final View decorView = window . getDecorView ( ) ; final int decorWidth = decorView . getWidth ( ) ; final int decorHeight = decorView . getHeight ( ) ; registerObserver ( ) ; mPopupContent . onMeasure ( View . MeasureSpec . makeMeasureSpec ( decorWidth , View . MeasureSpec . AT_MOST ) , View . MeasureSpec . makeMeasureSpec ( decorHeight , View . MeasureSpec . AT_MOST ) ) ; mPopupWindow = new PopupWindow ( mPopupContent , mPopupContent . getMeasuredWidth ( ) , mPopupContent . getMeasuredHeight ( ) ) ; mPopupWindow . showAsDropDown ( mAnchorViewRef . get ( ) ) ; updateArrows ( ) ; if ( mNuxDisplayTime > 0 ) { mPopupContent . postDelayed ( new Runnable ( ) { public void run ( ) { dismiss ( ) ; } } , mNuxDisplayTime ) ; } mPopupWindow . setTouchable ( true ) ; mPopupContent . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View v ) { dismiss ( ) ; } } ) ; } }
|
Display this tool tip to the user
|
5,667
|
public void onCreate ( Bundle savedInstanceState ) { Session session = Session . getActiveSession ( ) ; if ( session == null ) { if ( savedInstanceState != null ) { session = Session . restoreSession ( activity , null , callback , savedInstanceState ) ; } if ( session == null ) { session = new Session ( activity ) ; } Session . setActiveSession ( session ) ; } if ( savedInstanceState != null ) { pendingFacebookDialogCall = savedInstanceState . getParcelable ( DIALOG_CALL_BUNDLE_SAVE_KEY ) ; } }
|
To be called from an Activity or Fragment s onCreate method .
|
5,668
|
public void onResume ( ) { Session session = Session . getActiveSession ( ) ; if ( session != null ) { if ( callback != null ) { session . addCallback ( callback ) ; } if ( SessionState . CREATED_TOKEN_LOADED . equals ( session . getState ( ) ) ) { session . openForRead ( null ) ; } } IntentFilter filter = new IntentFilter ( ) ; filter . addAction ( Session . ACTION_ACTIVE_SESSION_SET ) ; filter . addAction ( Session . ACTION_ACTIVE_SESSION_UNSET ) ; broadcastManager . registerReceiver ( receiver , filter ) ; }
|
To be called from an Activity or Fragment s onResume method .
|
5,669
|
public void onActivityResult ( int requestCode , int resultCode , Intent data ) { onActivityResult ( requestCode , resultCode , data , null ) ; }
|
To be called from an Activity or Fragment s onActivityResult method .
|
5,670
|
public void onActivityResult ( int requestCode , int resultCode , Intent data , FacebookDialog . Callback facebookDialogCallback ) { Session session = Session . getActiveSession ( ) ; if ( session != null ) { session . onActivityResult ( activity , requestCode , resultCode , data ) ; } handleFacebookDialogActivityResult ( requestCode , resultCode , data , facebookDialogCallback ) ; }
|
To be called from an Activity or Fragment s onActivityResult method when the results of a FacebookDialog call are expected .
|
5,671
|
public void onSaveInstanceState ( Bundle outState ) { Session . saveSession ( Session . getActiveSession ( ) , outState ) ; outState . putParcelable ( DIALOG_CALL_BUNDLE_SAVE_KEY , pendingFacebookDialogCall ) ; }
|
To be called from an Activity or Fragment s onSaveInstanceState method .
|
5,672
|
public void onPause ( ) { broadcastManager . unregisterReceiver ( receiver ) ; if ( callback != null ) { Session session = Session . getActiveSession ( ) ; if ( session != null ) { session . removeCallback ( callback ) ; } } }
|
To be called from an Activity or Fragment s onPause method .
|
5,673
|
public static Evaluator definitionEvaluator ( HandlerDefinition hda ) { return definitionEvaluators . computeIfAbsent ( hda . evaluator ( ) , key -> { try { return hda . evaluator ( ) . getConstructor ( ) . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e ) { throw new IllegalStateException ( e ) ; } } ) ; }
|
Create a new definition evaluator .
|
5,674
|
public boolean matches ( TaskGroupInformation info ) { return getActivity ( ) . equals ( info . getActivity ( ) ) && getInputType ( ) . equals ( info . getInputType ( ) ) && getOutputType ( ) . equals ( info . getOutputType ( ) ) && info . matchesLocale ( getLocale ( ) ) ; }
|
Returns true if this specification matches the specified task group information .
|
5,675
|
public void logDomNodeList ( String msg , NodeList nodeList ) { StackTraceElement caller = StackTraceUtils . getCallerStackTraceElement ( ) ; String toLog = ( msg != null ? msg + "\n" : "DOM nodelist:\n" ) ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { toLog += domNodeDescription ( nodeList . item ( i ) , 0 ) + "\n" ; } if ( caller != null ) { logger . logp ( Level . FINER , caller . getClassName ( ) , caller . getMethodName ( ) + "():" + caller . getLineNumber ( ) , toLog ) ; } else { logger . logp ( Level . FINER , "(UnknownSourceClass)" , "(unknownSourceMethod)" , toLog ) ; } }
|
Log a DOM node list at the FINER level
|
5,676
|
public void logDomNode ( String msg , Node node ) { StackTraceElement caller = StackTraceUtils . getCallerStackTraceElement ( ) ; logDomNode ( msg , node , Level . FINER , caller ) ; }
|
Log a DOM node at the FINER level
|
5,677
|
public void logDomNode ( String msg , Node node , Level level , StackTraceElement caller ) { String toLog = ( msg != null ? msg + "\n" : "DOM node:\n" ) + domNodeDescription ( node , 0 ) ; if ( caller != null ) { logger . logp ( level , caller . getClassName ( ) , caller . getMethodName ( ) + "():" + caller . getLineNumber ( ) , toLog ) ; } else { logger . logp ( level , "(UnknownSourceClass)" , "(unknownSourceMethod)" , toLog ) ; } }
|
Log a DOM node at a given logging level and a specified caller
|
5,678
|
private String domNodeDescription ( Node node , int tablevel ) { String domNodeDescription = null ; String nodeName = node . getNodeName ( ) ; String nodeValue = node . getNodeValue ( ) ; if ( ! ( nodeName . equals ( "#text" ) && nodeValue . replaceAll ( "\n" , "" ) . trim ( ) . equals ( "" ) ) ) { domNodeDescription = tabs ( tablevel ) + node . getNodeName ( ) + "\n" ; NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes != null ) { for ( int i = 0 ; i < attributes . getLength ( ) ; i ++ ) { Node attribute = attributes . item ( i ) ; domNodeDescription += tabs ( tablevel ) + "-" + attribute . getNodeName ( ) + "=" + attribute . getNodeValue ( ) + "\n" ; } } domNodeDescription += tabs ( tablevel ) + "=" + node . getNodeValue ( ) + "\n" ; NodeList children = node . getChildNodes ( ) ; if ( children != null ) { for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { String childDescription = domNodeDescription ( children . item ( i ) , tablevel + 1 ) ; if ( childDescription != null ) { domNodeDescription += childDescription ; } } } } return domNodeDescription ; }
|
Form a DOM node textual representation recursively
|
5,679
|
public void setLevel ( Level level ) { this . defaultLevel = level ; logger . setLevel ( level ) ; for ( Handler handler : logger . getHandlers ( ) ) { handler . setLevel ( level ) ; } }
|
Set this level for all configured loggers
|
5,680
|
@ Handler ( channels = Self . class ) public void onRegistered ( NioRegistration . Completed event ) throws InterruptedException , IOException { NioHandler handler = event . event ( ) . handler ( ) ; if ( handler == this ) { if ( event . event ( ) . get ( ) == null ) { fire ( new Error ( event , "Registration failed, no NioDispatcher?" ) ) ; return ; } registration = event . event ( ) . get ( ) ; purger = new Purger ( ) ; purger . start ( ) ; fire ( new Ready ( serverSocketChannel . getLocalAddress ( ) ) ) ; return ; } if ( handler instanceof TcpChannelImpl ) { TcpChannelImpl channel = ( TcpChannelImpl ) handler ; channel . downPipeline ( ) . fire ( new Accepted ( channel . nioChannel ( ) . getLocalAddress ( ) , channel . nioChannel ( ) . getRemoteAddress ( ) , false , Collections . emptyList ( ) ) , channel ) ; channel . registrationComplete ( event . event ( ) ) ; } }
|
Handles the successful channel registration .
|
5,681
|
@ SuppressWarnings ( "PMD.DataflowAnomalyAnalysis" ) public void onClose ( Close event ) throws IOException , InterruptedException { boolean subOnly = true ; for ( Channel channel : event . channels ( ) ) { if ( channel instanceof TcpChannelImpl ) { if ( channels . contains ( channel ) ) { ( ( TcpChannelImpl ) channel ) . close ( ) ; } } else { subOnly = false ; } } if ( subOnly || ! serverSocketChannel . isOpen ( ) ) { fire ( new Closed ( ) ) ; return ; } synchronized ( channels ) { closing = true ; Set < TcpChannelImpl > conns = new HashSet < > ( channels ) ; for ( TcpChannelImpl conn : conns ) { conn . close ( ) ; } while ( ! channels . isEmpty ( ) ) { channels . wait ( ) ; } } serverSocketChannel . close ( ) ; purger . interrupt ( ) ; closing = false ; fire ( new Closed ( ) ) ; }
|
Shuts down the server or one of the connections to the server .
|
5,682
|
public static Vector < String > tokenize2vector ( final String source , final char delimiter ) { final Vector < String > v = new Vector < > ( ) ; StringBuilder currentS = new StringBuilder ( ) ; char c ; for ( int i = 0 ; i < source . length ( ) ; i ++ ) { c = source . charAt ( i ) ; if ( c == delimiter ) { v . addElement ( currentS . length ( ) > 0 ? currentS . toString ( ) : "" ) ; currentS = new StringBuilder ( ) ; } else { currentS . append ( c ) ; } } if ( currentS . length ( ) > 0 ) v . addElement ( currentS . toString ( ) ) ; return v ; }
|
Return a Vector with tokens from the source string tokenized using the delimiter char .
|
5,683
|
public static String removeCComments ( final String src ) { final StringBuilder ret = new StringBuilder ( ) ; boolean inComments = false ; for ( int i = 0 ; i < src . length ( ) ; i ++ ) { char c = src . charAt ( i ) ; if ( inComments ) { if ( c == '*' && src . charAt ( i + 1 ) == '/' ) { inComments = false ; i ++ ; } } else { if ( c == '/' ) { if ( src . charAt ( i + 1 ) == '*' ) { inComments = true ; i ++ ; } else { ret . append ( c ) ; } } else ret . append ( c ) ; } } return ret . toString ( ) ; }
|
Remove C commentaries .
|
5,684
|
public void cleanupAttachmentsForCall ( Context context , UUID callId ) { File dir = getAttachmentsDirectoryForCall ( callId , false ) ; Utility . deleteDirectory ( dir ) ; }
|
Removes any temporary files associated with a particular native app call .
|
5,685
|
@ SuppressWarnings ( "unchecked" ) public final T duplicate ( ) { if ( backing instanceof ByteBuffer ) { return ( T ) ( ( ByteBuffer ) backing ) . duplicate ( ) ; } if ( backing instanceof CharBuffer ) { return ( T ) ( ( CharBuffer ) backing ) . duplicate ( ) ; } throw new IllegalArgumentException ( "Backing buffer of unknown type." ) ; }
|
Duplicate the buffer .
|
5,686
|
public void process ( EventPipeline eventPipeline , EventBase < ? > event ) { try { for ( HandlerReference hdlr : this ) { try { hdlr . invoke ( event ) ; if ( event . isStopped ( ) ) { break ; } } catch ( AssertionError t ) { CoreUtils . setAssertionError ( t ) ; event . handlingError ( eventPipeline , t ) ; } catch ( Error e ) { throw e ; } catch ( Throwable t ) { event . handlingError ( eventPipeline , t ) ; } } } finally { try { event . handled ( ) ; } catch ( AssertionError t ) { CoreUtils . setAssertionError ( t ) ; event . handlingError ( eventPipeline , t ) ; } catch ( Error e ) { throw e ; } catch ( Throwable t ) { event . handlingError ( eventPipeline , t ) ; } } }
|
Invoke all handlers with the given event as parameter .
|
5,687
|
public Session getOpenSession ( ) { Session openSession = getSession ( ) ; if ( openSession != null && openSession . isOpened ( ) ) { return openSession ; } return null ; }
|
Returns the current Session that s being tracked if it s open otherwise returns null .
|
5,688
|
public void setSession ( Session newSession ) { if ( newSession == null ) { if ( session != null ) { session . removeCallback ( callback ) ; session = null ; addBroadcastReceiver ( ) ; if ( getSession ( ) != null ) { getSession ( ) . addCallback ( callback ) ; } } } else { if ( session == null ) { Session activeSession = Session . getActiveSession ( ) ; if ( activeSession != null ) { activeSession . removeCallback ( callback ) ; } broadcastManager . unregisterReceiver ( receiver ) ; } else { session . removeCallback ( callback ) ; } session = newSession ; session . addCallback ( callback ) ; } }
|
Set the Session object to track .
|
5,689
|
public void stopTracking ( ) { if ( ! isTracking ) { return ; } Session session = getSession ( ) ; if ( session != null ) { session . removeCallback ( callback ) ; } broadcastManager . unregisterReceiver ( receiver ) ; isTracking = false ; }
|
Stop tracking the Session and remove any callbacks attached to those sessions .
|
5,690
|
@ SuppressWarnings ( "PMD.ShortVariable" ) public < V > Optional < V > associated ( Object by , Class < V > type ) { Optional < V > result = super . associated ( by , type ) ; if ( ! result . isPresent ( ) ) { IOSubchannel upstream = upstreamChannel ( ) ; if ( upstream != null ) { return upstream . associated ( by , type ) ; } } return result ; }
|
Delegates the invocation to the upstream channel if no associated data is found for this channel .
|
5,691
|
public Task < AppLink > getAppLinkFromUrlInBackground ( final Uri uri ) { ArrayList < Uri > uris = new ArrayList < Uri > ( ) ; uris . add ( uri ) ; Task < Map < Uri , AppLink > > resolveTask = getAppLinkFromUrlsInBackground ( uris ) ; return resolveTask . onSuccess ( new Continuation < Map < Uri , AppLink > , AppLink > ( ) { public AppLink then ( Task < Map < Uri , AppLink > > resolveUrisTask ) throws Exception { return resolveUrisTask . getResult ( ) . get ( uri ) ; } } ) ; }
|
Asynchronously resolves App Link data for the passed in Uri
|
5,692
|
public void flush ( ) { if ( eventLoop . inEventLoop ( ) ) { pending ++ ; if ( pending >= maxPending ) { pending = 0 ; channel . flush ( ) ; } } if ( woken == 0 && WOKEN . compareAndSet ( this , 0 , 1 ) ) { woken = 1 ; eventLoop . execute ( wakeup ) ; } }
|
Schedule an asynchronous opportunistically batching flush .
|
5,693
|
public void onStart ( Start event ) { synchronized ( this ) { if ( runner != null ) { return ; } buffers = new ManagedBufferPool < > ( ManagedBuffer :: new , ( ) -> { return ByteBuffer . allocateDirect ( bufferSize ) ; } , 2 ) ; runner = new Thread ( this , Components . simpleObjectName ( this ) ) ; runner . setDaemon ( true ) ; runner . start ( ) ; } }
|
Starts a thread that continuously reads available data from the input stream .
|
5,694
|
@ Handler ( priority = - 10000 ) public void onStop ( Stop event ) throws InterruptedException { synchronized ( this ) { if ( runner == null ) { return ; } runner . interrupt ( ) ; synchronized ( this ) { if ( registered ) { unregisterAsGenerator ( ) ; registered = false ; } } runner = null ; } }
|
Stops the thread that reads data from the input stream . Note that the input stream is not closed .
|
5,695
|
public static ComponentVertex componentVertex ( ComponentType component , Channel componentChannel ) { if ( component instanceof ComponentVertex ) { return ( ComponentVertex ) component ; } return ComponentProxy . getComponentProxy ( component , componentChannel ) ; }
|
Return the component node for a given component .
|
5,696
|
private void setTree ( ComponentTree tree ) { synchronized ( this ) { this . tree = tree ; for ( ComponentVertex child : children ) { child . setTree ( tree ) ; } } }
|
Set the reference to the common properties of this component and all its children to the given value .
|
5,697
|
@ SuppressWarnings ( "PMD.UseVarargs" ) void collectHandlers ( Collection < HandlerReference > hdlrs , EventBase < ? > event , Channel [ ] channels ) { for ( HandlerReference hdlr : handlers ) { if ( hdlr . handles ( event , channels ) ) { hdlrs . add ( hdlr ) ; } } for ( ComponentVertex child : children ) { child . collectHandlers ( hdlrs , event , channels ) ; } }
|
Collects all handlers . Iterates over the tree with this object as root and for all child components adds the matching handlers to the result set recursively .
|
5,698
|
public GraphPlace getSelection ( ) { Collection < GraphPlace > selection = getSelectedGraphObjects ( ) ; return ( selection != null && ! selection . isEmpty ( ) ) ? selection . iterator ( ) . next ( ) : null ; }
|
Gets the currently - selected place .
|
5,699
|
protected boolean hasFieldError ( String fieldname ) { if ( StringUtils . isEmpty ( fieldname ) ) { return false ; } Object action = ActionContext . getContext ( ) . getActionInvocation ( ) . getAction ( ) ; if ( ! ( action instanceof ActionSupport ) ) { return false ; } ActionSupport asupport = ( ActionSupport ) action ; Map < String , List < String > > fieldErrors = asupport . getFieldErrors ( ) ; if ( CollectionUtils . isEmpty ( fieldErrors ) ) { return false ; } List < String > targetFieldErrors = fieldErrors . get ( fieldname ) ; if ( CollectionUtils . isEmpty ( targetFieldErrors ) ) { return false ; } return true ; }
|
If Struts2 has field - error for request parameter name return true .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.